airsdk / Adobe-Runtime-Support

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

Unable to create .aab file ? Says Invalid package name as "new" is a JAVA keyword #1397

Open Gokulv617 opened 2 years ago

Gokulv617 commented 2 years ago

AIR 33.1.1.575, AIR 33.1.1.620 Adobe Animate 22.0.1

My app package id - air.com.hfg.christmas.santa.celebration.escape.party.room.new.year.game.free. This game is uploaded last year to playstore and I have no problem in generating .apk file. But when I try to generate .aab file, then the below error occurs. Says invalid package name as "new" is a JAVA keyword. How to resolve this issue ? Please help

img_20211126

ajwfrost commented 2 years ago

This would be an issue because the ID given in the app descriptor file is used both as the Android Application ID, and as the Android package name. But these don't actually have to be the same: https://www.geeksforgeeks.org/android-package-name-vs-application-id/

So, the Android Application ID can have 'new' in it, but the Android package name can't. Not quite sure how it was working previously with the APK output, but for an App Bundle we can perhaps parse the package name to change keywords like these..

It would be possible to change this manually if you output an AndroidStudioProject folder, but I'll ask someone to make the changes here to separate out the package name and ensure it's not got reserved words in it...

thanks

Gokulv617 commented 2 years ago

I have attached the AndroidStudioProject for your reference.

Gokulv617 commented 2 years ago

How can I change this manually. Please guide me

This would be an issue because the ID given in the app descriptor file is used both as the Android Application ID, and as the Android package name. But these don't actually have to be the same: https://www.geeksforgeeks.org/android-package-name-vs-application-id/

So, the Android Application ID can have 'new' in it, but the Android package name can't. Not quite sure how it was working previously with the APK output, but for an App Bundle we can perhaps parse the package name to change keywords like these..

It would be possible to change this manually if you output an AndroidStudioProject folder, but I'll ask someone to make the changes here to separate out the package name and ensure it's not got reserved words in it...

thanks

ajwfrost commented 2 years ago

To change this (via Android Studio, with the "Android" project view):

I don't think you have to change the rest of the values in the Android Manifest, judging by the fact you had this set up previously for APKs...

thanks

Gokulv617 commented 2 years ago

I followed all the steps and changed it.

with a file explorer, change the folder name under the AndroidStudioProject\app folder so that it's also set to _new

I don't understand the above line ? which folder should I rename ? is it app folder under AndroidStudioProject ?

ajwfrost commented 2 years ago

No, if you expand app\src\main\java and keep on going down, it's the folder called "new" that needs to be renamed to "_new" so that it matches the Java package name: image

Gokulv617 commented 2 years ago

Thanks for the help. I changed all the areas mentioned by you. I closed the project and opened again and tried creating .aab file but again the same error occurs

Gokulv617 commented 2 years ago

can you please elaborate this line reload the project from disk(the final step)

Gokulv617 commented 2 years ago

yes I did the final step. Sorry, I forgot to open the project folder from Android Studio.

ajwfrost commented 2 years ago

can you please elaborate this line reload the project from disk(the final step)

From the Android Studio "File" menu, about half way down: "Reload All from Disk". But if you've closed it and re-opened it, it should have done the same..

Are you still seeing "Package ... from AndroidManifest.xml is not a valid Java package name .."? If so can you double-check in that AndroidManifest.xml file that the 'package' entry near the top no longer has "new" in it?

thanks

Gokulv617 commented 2 years ago

can you please elaborate this line reload the project from disk(the final step)

From the Android Studio "File" menu, about half way down: "Reload All from Disk". But if you've closed it and re-opened it, it should have done the same..

Are you still seeing "Package ... from AndroidManifest.xml is not a valid Java package name .."? If so can you double-check in that AndroidManifest.xml file that the 'package' entry near the top no longer has "new" in it?

thanks

I changed everything and did "Reload All from Disk" and tried to create .aab from Animate. Then whatever i changed previously got reverted and the error occurs. I have attached a detailed screen record your reference.

ajwfrost commented 2 years ago

Yes, everything will be overwritten when you use Animate again ... if you make the changes, you then need to build from Android Studio itself... "Build" menu, then "Build Bundle(s) / APK(s)" for a debug build or "Generate signed Bundle/APK" for release build..

Or if you can just confirm that the above steps worked (e.g. just do "Build -> Make Project" which creates a debug apk) then we can perhaps get you a patched ADT to make those changes as part of the normal Animate/publish process...

ajwfrost commented 2 years ago

@Gokulv617 please try with the below version which should do all these changes automatically when using the normal package/publish process: https://transfer.harman.com/message/gbXrnvk8fLTVDk2kIBp6h7

thanks

Gokulv617 commented 2 years ago

I downloaded the adt.jar and replaced in the SDK folder. I currently use AIR 33.1.1.620 for Android builds. When I replace this new adt.jar, the AIR SDK then shows like AIR 33.1.1.686. Is this a issue ? or the new adt.jar should be replaced for AIR 33.1.1.686 only ? is AIR 33.1.1.686 stable to publish android builds to playstore ?

img_20211127

Gokulv617 commented 2 years ago

I downloaded the adt.jar and replaced in the SDK folder. I currently use AIR 33.1.1.620 for Android builds. When I replace this new adt.jar, the AIR SDK then shows like AIR 33.1.1.686. Is this a issue ? or the new adt.jar should be replaced for AIR 33.1.1.686 only ?

img_20211127

is AIR 33.1.1.

ajwfrost commented 2 years ago

Yes that was built on top of 33.1.1.686 so you'll get a mismatch if you try building against an earlier version of the AIR runtime classes/libraries ..

Gokulv617 commented 2 years ago

is AIR 33.1.1.686 stable to publish android builds to playstore ?

ajwfrost commented 2 years ago

There's one issue I'm aware of that may cause a problem which is about audio, but it's been an issue for a long while.. we've not been able to reproduce the problem here though. I think the same thing is in .620 - basically a small chance of a crash following what appears to be some race condition when shutting down the Android audio system.

But if you're concerned, it wouldn't be too tricky to do that ADT build with it set up for .620...?

ajwfrost commented 2 years ago

.. would likely be on Monday though

Gokulv617 commented 2 years ago

.. would likely be on Monday though

Okay no problem. I can wait

Gokulv617 commented 2 years ago

I downloaded the latest AIR 33.1.1.686 and replaced the adt.jar and tried to publish .aab. It returned this error. This time I changed the JAVA_HOME path to android studio latest jre path.

img_20211127(1)

adt.cfg img_20211127(2)

ajwfrost commented 2 years ago

@Gokulv617 I'm betting there's a space in a path somewhere that is confusing the jarsigner command line... are you able to uncomment the "DebugOut=true" line in that config file and then run it again, and then open "c:\users\gokul\adt.log"? there should be a line near the end starting with "AAB signer command:", if you can copy/paste that (remove any private info if necessary although it shouldn't have your password in it I hope..) we can see which paths need to be processed. Just tried here with a space in the working folder path - we got an error but not the same one as you saw!

thanks

Gokulv617 commented 2 years ago

I have pasted the adt.log commands below

AAB Packager entry point
Version in APK = 33.1.1.686, version of ADT = 33.1.1.686
Version in APK = 33.1.1.686, version of ADT = 33.1.1.686
Version in APK = 33.1.1.686, version of ADT = 33.1.1.686
Version in APK = 33.1.1.686, version of ADT = 33.1.1.686
Gradle build where ADT is using JRE version 11.0.12
but where Gradle will be using the JDK from C:/Program Files/Android/Android Studio/jre\bin\java.exe
Gradle build command:  C:/Program Files/Android/Android Studio/jre\bin\java.exe -Xmx1024m -Dorg.gradle.appname=gradlew -Dorg.gradle.jvmargs=-Xmx1024m -Duser.dir="F:\ANDROID FINAL STORE FILES\Littlesanta-DISTRIQT\AndroidStudioProject" -cp "D:\AIR 33.1.1.686\lib\android\bin\gradle-wrapper.jar";"D:\AIR 33.1.1.686\lib\android\bin\gradle-cli.jar" org.gradle.wrapper.GradleWrapperMain :app:bundleRelease
AAB signer command:  C:/Program Files/Android/Android Studio/jre\bin\jarsigner.exe -storetype PKCS12 -keystore D:/R&D/Leaderboard/save my king2.p12 -storepass xxxx F:\ANDROID FINAL STORE FILES\Littlesanta-DISTRIQT\AndroidStudioProject/app/build/outputs/bundle/release/app-release.aab 1
..java.base/java.lang.Thread.getStackTrace(Unknown Source)
..com.adobe.air.DebugFile.printStack(DebugFile.java)
..com.adobe.air.ADTException.<init>(ADTException.java)
..com.adobe.air.apk.AABOutputStream.jarSign(AABOutputStream.java)
..com.adobe.air.apk.AABPackager.renameOutput(AABPackager.java)
..com.adobe.air.ApplicationPackager.createPackage(ApplicationPackager.java)
..com.adobe.air.apk.AABPackager.createPackage(AABPackager.java)
..com.adobe.air.ADT.parseArgsAndGo(ADT.java)
..com.adobe.air.ADT.run(ADT.java)
..com.adobe.air.ADT.main(ADT.java)
Stack trace:
Unexpected failure: Unable to run jarsigner: com.adobe.air.ADTException: Android App Bundler signing failed: Please specify jarfile name
'D' is not recognized as an internal or external command,
operable program or batch file.
ajwfrost commented 2 years ago

Okay the error is because of the '&' character in the path "R&D". Looks like we should just be able to quote that argument though (I thought we already were!) - will check...

In the meantime though, you can manually sign it yourself with:

"C:/Program Files/Android/Android Studio/jre\bin\jarsigner.exe" -storetype PKCS12 -keystore "D:/R&D/Leaderboard/save my king2.p12" -storepass xxxx "F:\ANDROID FINAL STORE FILES\Littlesanta-DISTRIQT\AndroidStudioPro
ject/app/build/outputs/bundle/release/app-release.aab" 1

thanks

Gokulv617 commented 2 years ago

Okay the error is because of the '&' character in the path "R&D". Looks like we should just be able to quote that argument though (I thought we already were!) - will check...

In the meantime though, you can manually sign it yourself with:

"C:/Program Files/Android/Android Studio/jre\bin\jarsigner.exe" -storetype PKCS12 -keystore "D:/R&D/Leaderboard/save my king2.p12" -storepass xxxx "F:\ANDROID FINAL STORE FILES\Littlesanta-DISTRIQT\AndroidStudioPro
ject/app/build/outputs/bundle/release/app-release.aab" 1

thanks

I changed the folder name and now it does not have any '&' symbol but still this error pops!

AAB Packager entry point
Version in APK = 33.1.1.686, version of ADT = 33.1.1.686
Version in APK = 33.1.1.686, version of ADT = 33.1.1.686
Version in APK = 33.1.1.686, version of ADT = 33.1.1.686
Version in APK = 33.1.1.686, version of ADT = 33.1.1.686
Gradle build where ADT is using JRE version 11.0.12
but where Gradle will be using the JDK from C:/Program Files/Android/Android Studio/jre\bin\java.exe
Gradle build command:  C:/Program Files/Android/Android Studio/jre\bin\java.exe -Xmx1024m -Dorg.gradle.appname=gradlew -Dorg.gradle.jvmargs=-Xmx1024m -Duser.dir="F:\ANDROID FINAL STORE FILES\Littlesanta-DISTRIQT\AndroidStudioProject" -cp "D:\AIR 33.1.1.686\lib\android\bin\gradle-wrapper.jar";"D:\AIR 33.1.1.686\lib\android\bin\gradle-cli.jar" org.gradle.wrapper.GradleWrapperMain :app:bundleRelease
AAB signer command:  C:/Program Files/Android/Android Studio/jre\bin\jarsigner.exe -storetype PKCS12 -keystore F:/save my king2.p12 -storepass xxxx F:\ANDROID FINAL STORE FILES\Littlesanta-DISTRIQT\AndroidStudioProject/app/build/outputs/bundle/release/app-release.aab 1
..java.base/java.lang.Thread.getStackTrace(Unknown Source)
..com.adobe.air.DebugFile.printStack(DebugFile.java)
..com.adobe.air.ADTException.<init>(ADTException.java)
..com.adobe.air.apk.AABOutputStream.jarSign(AABOutputStream.java)
..com.adobe.air.apk.AABPackager.renameOutput(AABPackager.java)
..com.adobe.air.ApplicationPackager.createPackage(ApplicationPackager.java)
..com.adobe.air.apk.AABPackager.createPackage(AABPackager.java)
..com.adobe.air.ADT.parseArgsAndGo(ADT.java)
..com.adobe.air.ADT.run(ADT.java)
..com.adobe.air.ADT.main(ADT.java)
Stack trace:
Unexpected failure: Unable to run jarsigner: com.adobe.air.ADTException: Android App Bundler signing failed: Only one alias can be specified

img_20211203

ajwfrost commented 2 years ago

"Only one alias can be specified" is because there are spaces in the path names, and the arguments need to be surrounded by quotes ... something I can't believe we missed :-(

Gokulv617 commented 2 years ago

Okay! When can I get the updated adt or sdk ?

ajwfrost commented 2 years ago

Please patch the 698 SDK with this adt.jar file: https://transfer.harman.com/message/mzUuP9IfjGEMCFNpsU7H99 thanks

Gokulv617 commented 2 years ago

Now I can create .aab file successfully. Below is the log file.

Called by: D:\AIR 33.1.1.698\lib\adt.jar
ADT 33.1.1.698 called with: -version
*** ADT Logging at 2021/12/03 17:43:16 ***
Called by: D:\AIR 33.1.1.698\lib\adt.jar
ADT 33.1.1.698 called with: -version
*** ADT Logging at 2021/12/03 17:44:04 ***
Called by: D:\AIR 33.1.1.698\lib\adt.jar
ADT 33.1.1.698 called with: -package -target apk-captive-runtime -arch armv7 -storetype PKCS12 -keystore F:/save my king2.p12 -storepass xxxxxx F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/littlesanta.apk F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/littlesanta-app.xml -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ littlesanta.swf Android/192.png Android/144.png Android/96.png Android/72.png Android/36.png Android/48.png -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ TITLE_panel.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ HSW_panel.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ ENTEREXIT_panel.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ LANGUAGE_panel.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ LEVELS_panel.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ EARNCOIN_panel.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ ACHIEVEMENT_panel.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ google-services.json -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ Christmas_CUI.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ LS_1.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ LS_2.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ LS_3.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ LS_4.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ LS_5.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ LS_6.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ LS_7.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ LS_8.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ LS_9.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ LS_10.swf -C F:/ANDROID FINAL STORE FILES/Littlesanta-DISTRIQT/ LS_11.swf -extdir C:/Users/Gokul/AppData/Local/Temp/littlesanta_ANE_Cache/
Overriding request for apk-captive-runtime, instead generating Android App Bundle
Ignoring architecture request for AAB target
AAB Packager entry point
Version in APK = 33.1.1.698, version of ADT = 33.1.1.698
Version in APK = 33.1.1.698, version of ADT = 33.1.1.698
Version in APK = 33.1.1.698, version of ADT = 33.1.1.698
Version in APK = 33.1.1.698, version of ADT = 33.1.1.698
Gradle build where ADT is using JRE version 11.0.12
but where Gradle will be using the JDK from C:/Program Files/Android/Android Studio/jre\bin\java.exe
Gradle build command:  C:/Program Files/Android/Android Studio/jre\bin\java.exe -Xmx1024m -Dorg.gradle.appname=gradlew -Dorg.gradle.jvmargs=-Xmx1024m -Duser.dir="F:\ANDROID FINAL STORE FILES\Littlesanta-DISTRIQT\AndroidStudioProject" -cp "D:\AIR 33.1.1.698\lib\android\bin\gradle-wrapper.jar";"D:\AIR 33.1.1.698\lib\android\bin\gradle-cli.jar" org.gradle.wrapper.GradleWrapperMain :app:bundleRelease
AAB signer command:  C:/Program Files/Android/Android Studio/jre\bin\jarsigner.exe -storetype PKCS12 -keystore F:/save my king2.p12 -storepass xxxx F:\ANDROID FINAL STORE FILES\Littlesanta-DISTRIQT\AndroidStudioProject/app/build/outputs/bundle/release/app-release.aab 1
Gokulv617 commented 2 years ago

Can I publish my android app with AIR 33.1.1.698 with the patched adt ?

ajwfrost commented 2 years ago

Yes for sure, we've got the .698 runtime files and debug info stored now, and the ADT just impacts the packaging rather than the runtime so feel free to go ahead.

FWIW we're also just updating the ADT version-matching to be a little more forgiving of version mismatches, which means you could take a new ADT.jar file and use it on an old SDK as long as it's got the same major/minor info. Which may not be relevant to you know you've updated to .698 but it would mean your original problem with build .575 or .620 would be solved by just dropping the latest ADT on top of those..

thanks

Gokulv617 commented 2 years ago

Thank you so much for the swift action taken. Keep rocking!!