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

My Android app won't start with AIR 33.1.1.779 (Beta)

Open KupoGames opened this issue 3 years ago • 16 comments

My app won't start on my Android phone when I update to the latest version of AIR. The APK compiles without any warnings, and works when testing it on my PC in Adobe Flash. I'm pretty sure I copied the AIR license and config files correctly when updating, but it's possible I missed some other setting. The app starts correctly when I go back to AIR 33.1.1.743

I get the "This app has stopped" message when I try to start the app on my device, and the logcat says the error is: Fatal signal 6 (SIGABRT), code -6 in tid 26666 (cBattleFantasy5) Here's the full crash report from logcat. The app ID is "air.EpicBattleFantasy5"

I've tried compiling some of my smaller apps with the latest version of AIR, and they work correctly. The problem is specific to my latest and largest app, which is a very complex 130MB swf.

Thanks.

KupoGames avatar Feb 23 '22 13:02 KupoGames

Hi It looks like a problem with the multidex support:

02-23 11:07:39.593 26666 26666 I MultiDex: VM with version 2.1.0 has multidex support
02-23 11:07:39.593 26666 26666 I MultiDex: Installing application
02-23 11:07:39.593 26666 26666 I MultiDex: VM has multidex support, MultiDex support library is disabled.
02-23 11:07:39.610 26666 26666 I zygote  : Rejecting re-init on previously-failed class java.lang.Class<androidx.work.impl.utils.futures.AbstractFuture>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/common/util/concurrent/ListenableFuture;
02-23 11:07:39.610 26666 26666 I zygote  : Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.common.util.concurrent.ListenableFuture" on path: DexPathList[[zip file "/data/app/air.EpicBattleFantasy5-2Df7f6uMJOPZGNL37ZOLjQ==/base.apk"],nativeLibraryDirectories=[/data/app/air.EpicBattleFantasy5-2Df7f6uMJOPZGNL37ZOLjQ==/lib/arm, /data/app/air.EpicBattleFantasy5-2Df7f6uMJOPZGNL37ZOLjQ==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]

I think the initial message is fine - basically saying there's no need for the multidex library because the Android VM already supports it - but then it's saying it can't find a class within the base.apk file (i.e. in the classes.dex file). I'm guessing if you inspect that APK, you'd find multiple classesN.dex with the above ListenableFuture one not being present in the plain classes.dex file...

I'm interested by the fact you say it worked with the 743 build... are you able to enable logging (in the lib/adt.cfg files in each SDK, uncomment "DebugOut=true") and then build it with each of the SDKs, and then send us the log file (in your home folder - c:\users\username on windows, or /Users/username on mac)?

thanks

ajwfrost avatar Feb 23 '22 15:02 ajwfrost

Here are the logs, the only setting I changed between the two compiles is the AIR version in the Adobe Flash publish settings. build 743 (launches on my device) build 779 (fails to start on my device)

KupoGames avatar Feb 23 '22 16:02 KupoGames

Thanks ... interestingly, both of these are using the Gradle build mechanism:

743: Gradle build command:  C:/Progra~1/Java/jdk-16.0.1\bin\java.exe -Xmx4096m -Dorg.gradle.appname=gradlew -Dorg.gradle.jvmargs=-Xmx4096m -Duser.dir="C:\Users\Matt\AppData\Local\Temp\35300748-4342-49d7-a611-5cae79a08f68" -cp "C:\Program Files\Adobe\Adobe Flash CC 2015\AIR 33.1.1.743\lib\android\bin\gradle-wrapper.jar";"C:\Program Files\Adobe\Adobe Flash CC 2015\AIR 33.1.1.743\lib\android\bin\gradle-cli.jar" org.gradle.wrapper.GradleWrapperMain :app:assembleRelease
779: Gradle build command:  C:/Progra~1/Java/jdk-16.0.1\bin\java.exe -Xmx4096m -Dorg.gradle.appname=gradlew -Dorg.gradle.jvmargs=-Xmx4096m -Duser.dir="C:\Users\Matt\AppData\Local\Temp\924433b8-2211-493b-a273-d71cb3123a5d" -cp "C:\Program Files\Adobe\Adobe Flash CC 2015\AIR 33.1.1.779\lib\android\bin\gradle-wrapper.jar";"C:\Program Files\Adobe\Adobe Flash CC 2015\AIR 33.1.1.779\lib\android\bin\gradle-cli.jar" org.gradle.wrapper.GradleWrapperMain :app:assembleRelease

So the difference must either be (a) in the project structure we're putting together in that temp folder before triggering the gradle build, or (b) in gradle (or the Android Gradle Plug-in) itself.

The gradle version we're looking for hasn't changed since 33.1.1.713 in December when we updated it to use 7.3 so that it worked with Java 17. So I'm wondering about the project structure...

If you edit the "adt.cfg" files in the SDK "lib" folders, there's an option you can uncomment "KeepAndroidStudioOutput=true". If you try packaging up with that, then you'll get an "AndroidStudioProject" folder being created: if you rename this after each build, it should then be possible to compare one that's created with 33.1.1.743 with one that's created with 33.1.1.779.

We can try this here too, but would have to create a lot of dummy code to push it up to the level where the multidex kicks in properly..

thanks

ajwfrost avatar Feb 23 '22 17:02 ajwfrost

Here's the two AndroidStudioProject folders. They're around 900MB each.

743 779

They seem to be almost identical, but a directory comparison showed that the DEX files were some of the few files that were different. I have no idea how to interpret any of the contents though.

KupoGames avatar Feb 23 '22 20:02 KupoGames

If it helps, I can share my source files.

KupoGames avatar Feb 28 '22 10:02 KupoGames

@KupoGames we weren't able to download those projects from above, is it possible to zip them first? Dropbox was complaining of the size ... or alternatively can you upload them via the below link please (as zips)? https://transfer.harman.com/requests/GbdzJguTj21mAzGTYIREtK thanks

ajwfrost avatar Feb 28 '22 16:02 ajwfrost

Oh, sorry. I've uploaded the two folders as zip files through the link you provided. Thanks.

KupoGames avatar Feb 28 '22 19:02 KupoGames

@ajwfrost I don't know if there's been any progress on this issue, but I tried the latest version of AIR (795), and I get a very similar error when I try to launch the app on my device. Here's the logcat: https://www.dropbox.com/s/q1su9h5j1cx4316/logcat%20from%20AIR%20795.txt?dl=0

Also the latest version of AIR did not like this line in my manifest file, and gave me an error: uses-sdk android:minimumSdkVersion="19" android:targetSdkVersion="30" It finished compiling when I removed this line. I used this line in earlier versions of AIR to make sure it did not target Android 12.

Thanks.

KupoGames avatar Mar 11 '22 13:03 KupoGames

Hi I believe we had found/fixed the earlier issue, but the log above is also showing something happening that we believed we'd fixed in the 795 build:

Abort message: 'thread.cc:2016] No pending exception expected: java.lang.OutOfMemoryError: PushLocalFrame'

The log doesn't actually give much indication of what's taking up the memory: we had seen another log where there was some output about the number of different objects that were present within the JNI system and there was one class causing a problem which we've since addressed. But perhaps there's some other conditions in which we're not cleaning up the JNI objects hence ending up with this message. Curious that it happens during start-up though rather than after a few minutes of execution!

We'll have a further look; if we can't reproduce it (or see some indication of JNI memory increasing) with our test cases, we may need to ask you to build with a custom AIR binary and run it there to capture some logs...

thanks

ajwfrost avatar Mar 11 '22 13:03 ajwfrost

@ajwfrost Thanks, I'm happy to help out any way that I can. Is there anything I could try? Like using a different version of the Android SDK or a different version of Java? Or is the problem definitely with AIR?

KupoGames avatar Mar 11 '22 13:03 KupoGames

@ajwfrost Hi, I've been working on other projects for a while, but I tried compiling my EBF5 Android app again, this time with AIR version 899, and I still have this same problem. The app runs on my PC, but stops when starting up on my Android devices. I've tried an Android 8 and an Android 12 device. My smaller apps compile and run correctly with AIR 899, it's still just my biggest app that has this issue. The latest version that works for this app is AIR 743.

The compiler gives me a note, I don't know if this is relevant: "Multiple Android build-tools folders exist, choosing the latest version (31.0.0 rc5) for packaging."

This line still appears in the logcat: Abort message: 'thread.cc:2016] No pending exception expected: java.lang.OutOfMemoryError: PushLocalFrame'

Is there anything I should try?

KupoGames avatar Jul 20 '22 13:07 KupoGames

Hi @KupoGames - we've had a couple of folk with this issue still, but we've not managed to reproduce it here. Is this reproducible on Android 8? as if so, if you're able to compile your app using the "apk-debug" option and send it to us, we should be able to (a) reproduce it and then (b) debug it properly.

The expectation is that the OutOfMemoryError is caused by too many Java objects being created within a single frame of the native code, but we're not sure if this is a leak or if it's just a platform limitation. I'm wondering whether you have 500+ text fields being created, as it may be related to this...?!

The compiler warning isn't an issue, that's just saying that it's using the latest of the Android build tools that are available in the Android SDK folder.

thanks

ajwfrost avatar Jul 20 '22 13:07 ajwfrost

@ajwfrost Yeah, it happens on Android 8 too.

My app contains several books worth of text (it supports 12 languages), but none of that is used in the first few frames, as far as I am aware. All of this text is stored in paragraph-sized strings, as public static vars in AS3 class files. I'm pretty sure I don't use 500+ text fields in one frame, especially on the first few frames.

Here is a debug build apk of the app, hope it helps: https://www.dropbox.com/s/67lrud1ybf9oa2e/EpicBattleFantasy5.apk?dl=0

Thanks

KupoGames avatar Jul 20 '22 14:07 KupoGames

Thanks .. oddly though, it works for me when I run this on an old phone (actually Android 9, a Samsung S8 handset). So we may need to do the other way round per the earlier suggestion - if you're okay with me sending you a different runtime.apk file to put into the SDK which has some extra traces out, then if you can run it with a logcat output (or adt -devicelog) we can see what's happening...

ajwfrost avatar Jul 20 '22 15:07 ajwfrost

@ajwfrost Huh, that's weird. I've tried it on an old phone and a new one, and had no luck with either. Please send me the runtime.apk and I'll try it out.

KupoGames avatar Jul 20 '22 15:07 KupoGames

@KupoGames we've uploaded the test runtime, have put it into the other issue which is basically the same as the outstanding part of this one: https://github.com/airsdk/Adobe-Runtime-Support/issues/1950#issuecomment-1192209307

thanks

ajwfrost avatar Jul 22 '22 05:07 ajwfrost