Adobe-Runtime-Support icon indicating copy to clipboard operation
Adobe-Runtime-Support copied to clipboard

Error generating IPA (windows with java 17)

Open caraiz opened this issue 2 years ago • 6 comments

Using java 17, adt generates this error:

"Cannot sign an IPA file on non-Mac platform: invalid JRE that does not expose sun.security classes"

Tested with Air SDK version: 33.1.1.795

I suppose the problem is the encapsulation of internal packages, and it will fails in next versions too: https://www.infoq.com/news/2021/06/internals-encapsulated-jdk17

caraiz avatar Mar 10 '22 11:03 caraiz

Yes exactly .. it looks like it may still be possible to tweak the command lines and change the implementation to use reflection but I suspect that would be a temporary solution. Ultimately, we want to get rid of the use of the internal Java APIs. On MacOS of course we can use the native 'codesign' tool, but there's nothing that really does that on Windows.

We have a task to look further into what could be done here, whether some of the functionality can be reworked using different APIs/tools etc. But for now, please use an earlier Java version, e.g. Java 11 will be supported for another 18 months..

thanks

ajwfrost avatar Mar 10 '22 14:03 ajwfrost

If this helps, adding "--add-opens java.base/sun.security.x509=ALL-UNNAMED --add-opens java.base/sun.security.util=ALL-UNNAMED" in java command seems solve that problem, but the implementation has changed and generates other error, so really is necessary review the sign process...

''' Exception in thread "main" java.lang.NoSuchMethodError: 'sun.security.util.ObjectIdentifier sun.security.util.ObjectIdentifier.newInternal(int[])' at com.adobe.air.ipa.MachoSigner.signToStream(MachoSigner.java) at com.adobe.air.ipa.MachoSigner.newCMSBlob(MachoSigner.java) at com.adobe.air.ipa.MachoSigner.sign(MachoSigner.java) at com.adobe.air.ipa.MachoSigner.sign(MachoSigner.java) at com.adobe.air.ipa.IPASigner.signMacho(IPASigner.java) at com.adobe.air.ipa.IPAOutputStream.finalizeSig(IPAOutputStream.java) at com.adobe.air.ApplicationPackager.createPackage(ApplicationPackager.java) at com.adobe.air.ipa.IPAPackager.createPackage(IPAPackager.java) at com.adobe.air.ADT.parseArgsAndGo(ADT.java) at com.adobe.air.ADT.run(ADT.java) at com.adobe.air.ADT.main(ADT.java) '''

The newInternal method only calls the constructor, so maybe calling directly to the constructor and adding the "--add-opens" can be a initial fix to solve the problem, but how you say, the better is try to avoid all those classes.

Thanks.

caraiz avatar Mar 10 '22 16:03 caraiz

I'm having this issue too. Is it not currently possible to build an IPA on Windows?

emmaassin avatar Jun 24 '22 21:06 emmaassin

I can still build an IPA on Windows, though I did have to switch to JDK 11.0.13 to get it to work though.

FliplineStudios avatar Jun 24 '22 21:06 FliplineStudios

Switching to JDK 11.0.13 didn't work for me - same error.

emmaassin avatar Jun 24 '22 22:06 emmaassin

Java 17 will cause errors but Java 11 should be possible .. although equally @emmaassin, there is a possibility that it's found the Java 17 installation and is still using that. If you enable the logging (airsdk_folder\lib\adt.cfg, to uncomment DebugOut=true) you should see more details in the c:\users\username\adt.log file..)

thanks

ajwfrost avatar Jun 25 '22 05:06 ajwfrost

hey @ajwfrost when is java 17 expected to be supported?

shaymolho avatar Nov 02 '22 08:11 shaymolho

@ajwfrost I'm getting this exact invalid JRE cannot sign error when trying to package an IPA file. I'm using Java 16. Is there a fix for this? I tried compiling using the SDK on my mac and I got an even more intimidating error of various exceptions on compilation. EDIT: I've tried the newest Java 19, same error. I tried Java 11 as suggested. It seems to get farther and try to sign and then it fails with a compilation error: And then it generates a long error log file. EDIT: I added the debug variable @ajwfrost recommended to get more detail and guess what? It compiled the IPA! Now, this is great however it does seem rather unstable and it would be ideal for the latest SDK to be working with the latest Java release, so I would think this should be pretty high priority. I also don't know if anything during compilation with this older Java release might be refused for app approval by the store.

cybomon avatar Mar 17 '23 21:03 cybomon

On Windows -> Java 11 is probably still best, I think there are also problems that Android Studio has with the latest Java versions. For IPA files, the Java code is just doing the packaging of the IPA (rather than anything that is inherently Java-ish), the challenge is in the code-signing where on macOS we can just use the native tools, but on Windows there is a whole load of code logic to create the appropriate macOS code signatures - and this was written using the private/internal Java security classes which are no longer accessible in these later JVMs.

So, refusal for the app store wouldn't come from the version of Java we're using, but rather from the execution of our Java app (if that makes sense!) -> you should be okay. But yes, I agree, it would be better if we could avoid the use of these internal classes, we do have an open task for this and we'd looked at it a while back... there may be some other third party tools we can try to pick up for this. I'll see if someone can look into that again with a bit more focus.

thanks

ajwfrost avatar Mar 17 '23 22:03 ajwfrost

@ajwfrost Thanks for the detailed information. I always did my ipa packaging on windows except for I believe when making an ipa that would run in the xcode simulator. I think I had to use the mac in the past for that. If the mac environment is better for ipa packaging, which would make sense, I'll try to move in that direction. When I have time, I'll look into the error I was getting packaging in osx and try to troubleshoot it. Thanks again.

cybomon avatar Mar 17 '23 23:03 cybomon

@ajwfrost Still cannot build ipa on with java 17 on windows I don't want to publish this ipa to app store so maybe that could be easier? the error i'm getting is:

 [exec] Cannot sign an IPA file on non-Mac platform: invalid JRE that does not expose sun.security classes

adt.log

shaymolho avatar Aug 20 '23 09:08 shaymolho

Yes, I think Java 16 is the latest you can use for signing IPA files on Windows.. Java 11 is still what I tend to use though.

ajwfrost avatar Aug 21 '23 06:08 ajwfrost

with java 16 same error: [exec] Cannot sign an IPA file on non-Mac platform: invalid JRE that does not expose sun.security classes

shaymolho avatar Aug 21 '23 09:08 shaymolho

Java 17 will cause errors but Java 11 should be possible .. although equally @emmaassin, there is a possibility that it's found the Java 17 installation and is still using that. If you enable the logging (airsdk_folder\lib\adt.cfg, to uncomment DebugOut=true) you should see more details in the c:\users\username\adt.log file..)

thanks

Hi. I've got the same problem. I did the uncomment and saw the details in the adt.log file. I saw that it was, indeed, still using the 17 version of java instead of the 16 that I have installed. ("Cannot create sun security class: JRE version = 17.0.6+9-LTS-190, Java Home = C:\Program Files\Adobe\Adobe Animate 2024\jre").

How/where can I tell it to use java 16 instead of 17 ?

Thx

stephanberger4 avatar Nov 28 '23 22:11 stephanberger4