airsdk / Adobe-Runtime-Support

Report, track and discuss issues in Adobe AIR. Monitored by Adobe - and HARMAN - and maintained by the AIR community.
198 stars 11 forks source link

Switchh to gradle and stuck #2488

Open marcanw opened 1 year ago

marcanw commented 1 year ago

I use Animate on Windows 10 with AIR 50.2.1.1. I tried to make the the jump to gradle in order upadte all my anes (what I did), but I'm stuck during the publishing. image

I installed the last Android Studio. I added JAVA_HOME=C:\Program Files\Android\Android Studio\jbr to the adt.cfg.

I don't know what to do now. Thank you for your help.

ajwfrost commented 1 year ago

Hmm.. error: unexpected element <queries> found in <manifest> <application> seems to suggest the Android manifest file has got mal-formed. Do you have a <queries> section under the <application> part of your <manifestAdditions>? it should be outside of that / alongside it i.e.

<manifestAdditions>
   ...
   <application> ... </application>
   <queries> ... </queries>
</manifestAdditions>

thanks

marcanw commented 1 year ago

Thx @ajwfrost I changed the xml. image

ajwfrost commented 1 year ago

New error this time! error: resource integer/google_play_services_version not found

This may be due to the change in how ANE resources are packaged up, are you using a Google Play ANE? and is it definitely compatible with the Gradle builds?

thanks

marcanw commented 1 year ago

Yes but I get the latest version from Distriqt

Here are the ANE's:

com.distriqt.Core com.distriqt.Camera com.distriqt.InAppBilling com.distriqt.Flurry com.distriqt.Share com.distriqt.playservices.Auth com.distriqt.Scanner com.distriqt.NetworkInfo com.distriqt.CameraUI com.distriqt.Application com.lancelotmobile.ane.nativedialogs com.lancelotmobile.ane.multipickgallery androidx.core androidx.browser androidx.cardview androidx.appcompat androidx.vectordrawable com.google.android.material com.distriqt.CustomResources com.google.android.datatransport com.google.dagger com.google.firebase.core com.distriqt.PushNotifications com.distriqt.AppleSignIn androidx.constraintlayout com.google.protobuflite com.distriqt.playservices.CloudMessaging com.distriqt.playservices.AppSet com.google.code.gson com.google.guava com.bumptech.glide io.reactivex androidx.exifinterface io.grpc com.distriqt.square.okhttp com.distriqt.square.okhttp3
ajwfrost commented 1 year ago

Not com.distriqt.playservices.Base?

I've just found a definition of google_play_services_version in com.distriqt.playservices.Base.ane\META-INF\ANE\Android-xxx\play-services-basement-18.0.0-res\values\values.xml

marcanw commented 1 year ago

Thx @ajwfrost I added com.distriqt.playservices.Base

image

ajwfrost commented 1 year ago

That's an interesting one -> sounds like two different ANEs are including some Java libraries that then conflict with each other:

android-support-v4.jar
collection-1.1.0.jar

I would think that the first of those shouldn't be used though, haven't all of these moved to androidx now? Tagging @marchbold as he may know off the top of his head what the issue is here... Although looking at the ANE list, there's loads of other ANEs so it may just be that one of them needs to be updated. I don't know of any workaround to a conflict like this... perhaps if you generate the android-studio target, you could open the output in Android Studio and then manually edit the build.gradle file to remove the android-support-v4 dependency?

thanks

marcanw commented 1 year ago

Thx @ajwfrost I checked and two old anes (com.google.android.material, com.distriqt.playservices.Auth) was still there. I removed them. But it didn't change anything :-( I still have the same errors. I check the dates of the distriqt anes and they are all up to date except com.distriqt.CustomResources (I don't remeber what is the purpose of it) but I removed it and it didn't change the error. There are still two non districqt anes : com.lancelotmobile.ane.nativedialogs and com.lancelotmobile.ane.multipickgallery. I don't think it contains conflicting libs. Is there a way for me to check in order to be sure?

ajwfrost commented 1 year ago

I'm not sure there's an easy way .. if you unzip the .ane file and go into one of the Android folders, you can then see what libraries are also included. If that doesn't work we could try to create a version of ADT that logs all the details of what libraries are found in what ANEs...

marcanw commented 1 year ago

Ok get this: image

Do you think I can simply remove it from the zip?

marchbold commented 1 year ago

Hi, looks like that older extension is using the legacy android support libraries. These are available in androidx in one of the legacy support libraries which is included in our androidx.core extension. So you should be able to remove the jar from that extension and repackage and it should work. (There can be some issues if it is using something that has been deprecated / removed however most common things work).

To remove it you need to extract the ane, delete the jar, remove it from the platform.xml, and then repackage the ane.

marcanw commented 1 year ago

Thx @marchbold I did it. Still stuck... image

I don't know if I can solve it on my side or if I have to contact the ane dev.

marchbold commented 1 year ago

Yeah that looks like you'll have to contact the ANE dev.

marcanw commented 1 year ago

He is on it, I should have something tomorrow.

marcanw commented 1 year ago

Ok I was able to build, Just had the following message: image

Bu now but it's crashing at startup. Here are the logs: log (3).txt

I checked all the dependencies and everything seems fine: com.distriqt.Core com.distriqt.Camera com.distriqt.InAppBilling com.distriqt.Flurry com.distriqt.Share com.distriqt.Scanner com.distriqt.NetworkInfo com.distriqt.CameraUI com.distriqt.Application com.lancelotmobile.ane.multipickgallery androidx.core androidx.browser androidx.cardview androidx.appcompat androidx.vectordrawable com.google.android.datatransport com.google.dagger com.google.firebase.core com.distriqt.PushNotifications com.distriqt.AppleSignIn androidx.constraintlayout com.google.protobuflite com.distriqt.playservices.CloudMessaging com.distriqt.playservices.AppSet com.google.code.gson com.google.guava com.bumptech.glide io.reactivex androidx.exifinterface io.grpc com.distriqt.square.okhttp com.distriqt.square.okhttp3 com.lancelotmobile.ane.nativedialogs com.distriqt.playservices.Base com.distriqt.CustomResources

marchbold commented 1 year ago

I'd suggest checking you have the latest of all the extensions, looks like you have two incompatible versions there somewhere.

marcanw commented 1 year ago

If I use APN and Firebase should I have to add com.distriqt.PushNotifications.FCM.ane or com.distriqt.PushNotifications.ane or both?

marchbold commented 1 year ago

Are you using Firebase on iOS? If not then just the main com.distriqt.PushNotifications extension supports Firebase on Android and APNS on iOS.

marcanw commented 1 year ago

I updated com.distriqt.PushNotifications.FCM.ane and it works (I thought I just need com.distriqt.PushNotifications.ane)

marcanw commented 1 year ago

So maybe I had to remove com.distriqt.PushNotifications.FCM.ane?

marcanw commented 1 year ago

If I remove com.distriqt.PushNotifications.FCM.ane, it doesn't compile

marchbold commented 1 year ago

You should only use one of the variants, using 2 will result in issues.

marcanw commented 1 year ago

Ok I was able to make a release with apk. I'm still unable to create an Android Bundle. I get the following message: image

ajwfrost commented 1 year ago

Unable to run jarsigner is an odd one, we should be finding an appropriate JDK installation (and there's no warning saying we couldn't) and then executing the 'jarsigner' binary that is part of that. Looking at the messages and the code, this means the jarsigner process returned a non-zero exit code, but without outputting any error message (which should appear at the end of the ADTException line..)

Can you configure ADT logging and check the entries in adt.log, it should give the command-line that's being used for the execution of jarsigner. Then perhaps check whether that jarsigner executable file is actually present, or whether you can run the command manually?

thanks

marcanw commented 1 year ago

Thx @ajwfrost Here is the adt.log adt.log I was able to run jarsigner.exe from the prompt.

marcanw commented 9 months ago

Hi, I'm still stuck when building CreateAndroidAppBundle=true image

ajwfrost commented 9 months ago

Hi @marcanw -> are you able to have AIR SDK Manager's Troubleshooting tab open when you do the build, or enable logging to file and check the c:\users\username\adt.log file? It should be outputting the command-line being used to do the signing... the actual issue seems to be that the "jarsigner.exe" binary is returning a non-zero exit code, and yet isn't displaying any output.

If we can check the command-line it's using, we can then see whether it's possible to manually run the same command. Worth enabling the "KeepAndroidStudioOutput" flag in the config as well, so that we keep the aab file around...

thanks

marcanw commented 9 months ago

@ajwfrost Here the logs adt.log

ajwfrost commented 9 months ago

Okay thanks -> are you able to then run this manually from a command prompt:

"C:/Program Files/Android/Android Studio/jbr\bin\jarsigner.exe" -storetype PKCS12 -keystore C:/work/droid.p12 -storepass xxxx C:\work\AndroidStudioProject/app/build/outputs/bundle/release/app-release.aab 1

replacing the 'xxxx' with your password...

Once this returns, please also then run:

echo %ERRORLEVEL%

so that we know what the return value was..

thanks

marcanw commented 9 months ago

jarsigner error: java.lang.RuntimeException: keystore load: keystore password was incorrect

C:\Users\HP>echo %ERRORLEVEL% 1

ajwfrost commented 9 months ago

Hi

The obvious question of course, is whether you had been using the right password! But it may also be something around the structure of the P12 file..

The command line there has the keystore (droid.p12) and the store password, together with the alias of the certificate in the store provided at the end (1 being the normal alias name..)

Your Java installation hopefully has a binary called keytool.exe so can you please check:

keytool -list -keystore c:/work/droid.p12

This should ask you for the store password, it should also be possible to use:

keytool -list -keystore c:/work/droid.p12 -storepass xxxxx

The result should list the entries in the p12 keystore file, can you check the output e.g. I get:

Keystore type: PKCS12
Keystore provider: SUN

Your keystore contains 1 entry

1, 22-May-2019, PrivateKeyEntry,
Certificate fingerprint (SHA-256): ....

So that 1 before the date is what we're looking for..

thanks

marcanw commented 9 months ago

All I get is erreur keytool : java.io.IOException: keystore password was incorrect And I'm 100% sure the pw is correct...

I add -v to the commande and get this:

java.io.IOException: keystore password was incorrect
        at java.base/sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:2116)
        at java.base/sun.security.util.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:222)
        at java.base/java.security.KeyStore.load(KeyStore.java:1479)
        at java.base/java.security.KeyStore.getInstance(KeyStore.java:1807)
        at java.base/java.security.KeyStore.getInstance(KeyStore.java:1687)
        at java.base/sun.security.tools.keytool.Main.doCommands(Main.java:928)
        at java.base/sun.security.tools.keytool.Main.run(Main.java:412)
        at java.base/sun.security.tools.keytool.Main.main(Main.java:405)
Caused by: java.security.UnrecoverableKeyException: failed to decrypt safe contents entry: java.security.cert.CertificateException: Unable to initialize, java.io.IOException: DerInputStream.getLength(): Redundant length bytes found
        ... 8 more
ajwfrost commented 9 months ago

Not sure if you have the openssl utilities, you could use those to check further perhaps but the error above does suggest that the password is being entered wrongly. Have you tried just typing the password plain-text into the console/terminal window there, to make sure the characters are output how you expect? I find sometimes my terminal screws up the character mapping so that things like £ and # get swapped, or capital letters get replaced by weird codes, etc...

The only slight thing I wonder is about the final message there, DerInputStream.getLength(): Redundant length bytes found. This implies an issue in the store file itself perhaps (but 'redundant' bytes shouldn't be an error? I would have expected a warning? unless it's not meaning what I think it does...).

If you have the .p12 file somewhere else where it's working, can you try checking the file signatures/checksums to make sure there's not been a glitch in copying it over?

thanks