Fixed
Status Update
Comments
rm...@google.com <rm...@google.com> #2
Thank you for your feedback. Team may reach out for more feedback in reproducing or triaging this issue.
rp...@google.com <rp...@google.com>
no...@google.com <no...@google.com> #3
For the version of the APK that does not run (the debuggable version), if you use the APK analyzer in studio, can you confirm that com.xxxx.yyyy.ZZZZApplication is somewhere in the dex files?
ke...@gmail.com <ke...@gmail.com> #4
Yes, Application class is in dex file. I will attach the screen shot. Please check it.
ke...@gmail.com <ke...@gmail.com> #5
I found an another solution.
Our project uses Firebase Performance Monitoring. If I remove the plugin, app is working.
I removed the below line from build.gradle.
apply plugin: 'com.google.firebase.firebase-perf'
And, I tried to reproduction on sample project. But I could not reproduction.
Our project uses Firebase Performance Monitoring. If I remove the plugin, app is working.
I removed the below line from build.gradle.
apply plugin: 'com.google.firebase.firebase-perf'
And, I tried to reproduction on sample project. But I could not reproduction.
du...@google.com <du...@google.com> #6
When you remove firebase-perf, where is com.xxxx.yyyy.ZZZZApplication? In classes.dex or classes2.dex? Does this have something to do with some restriction that the main activity needs to be in classes.dex on older multidex devices? The 65535 limit thing?
ke...@gmail.com <ke...@gmail.com> #7
Application class in classes2.dex. This project is 65535 limit.
da...@robinhood.com <da...@robinhood.com> #8
We are experiencing the same issue. I built the app in a couple different ways (all debuggable) and these are my findings:
AGP 3.4.0, firebase-perf enabled: 6 dex files
AGP 3.5.0-beta02, firebase-perf disabled: 40 dex files
AGP 3.5.0-beta02, firebase-perf enabled: 9,283 dex files <- this is the one that doesn't work on 21 & 22
I have read that 21 & 22 have a 100 dex file limit - if that's the case, it sounds like it's what's causing the class to not be found. Though it obviously doesn't explain why we went from having 6 dex files to 9,283.
AGP 3.4.0, firebase-perf enabled: 6 dex files
AGP 3.5.0-beta02, firebase-perf disabled: 40 dex files
AGP 3.5.0-beta02, firebase-perf enabled: 9,283 dex files <- this is the one that doesn't work on 21 & 22
I have read that 21 & 22 have a 100 dex file limit - if that's the case, it sounds like it's what's causing the class to not be found. Though it obviously doesn't explain why we went from having 6 dex files to 9,283.
da...@robinhood.com <da...@robinhood.com> #9
Oh, and also the application class for us is always in dex #2.
ja...@nimbus.co <ja...@nimbus.co> #10
I am experiencing a similar issue with my app. I am using the embrace.io plugin and while everything works on AGP 3.4, using AGP 3.5 and above results in 40 dex files in the resulting apk with all of the classes that should be in the main dex file defined in my multiDexKeepProguard file end up in classes2.dex. Running the application results in a NoClassDefFoundError crash on startup.
ga...@google.com <ga...@google.com>
ga...@google.com <ga...@google.com> #11
The issue happens when deploying debuggable application from the IDE on phones with API level 21+, and it may happen on APIs 23+ because of high number of DEX files. Workaround is to disable the FIrebase Performance plugin for debug builds.
I am fixing this in master with ag/I2561e4b4229862f9997873c88ddd21ecff41330e.
I am fixing this in master with ag/I2561e4b4229862f9997873c88ddd21ecff41330e.
ga...@google.com <ga...@google.com> #12
Merged to 3.5, it will be released with 3.5.0-beta04.
li...@gmail.com <li...@gmail.com> #13
Which version will fix this issue ? android studio ? gradle plugin? @ #12
ga...@google.com <ga...@google.com> #14
Android Gradle Plugin 3.5.0-beta04 will contain the fix.
[Deleted User] <[Deleted User]> #15
Not fixed in 3.5.0-beta04.
I got the following error. ZZZZApplication is in classes2.dex.
```
06-08 10:45:07.624 9677-9677/com.xxx.yyy.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xxx.yyy.debug, PID: 9677
java.lang.RuntimeException: Unable to instantiate application com.xxx.yyy.ZZZZApplication: java.lang.ClassNotFoundException: Didn't find class "com.xxx.yyy.ZZZZApplication" on path: DexPathList[[zip file "/data/app/com.xxx.yyy.debug-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:563)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4491)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xxx.yyy.ZZZZApplication" on path: DexPathList[[zip file "/data/app/com.xxx.yyy.debug-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newApplication(Instrumentation.java:979)
at android.app.LoadedApk.makeApplication(LoadedApk.java:558)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4491)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Suppressed: java.lang.NoClassDefFoundError: com.xxx.yyy.ZZZZApplication
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:321)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 14 more
Suppressed: java.lang.ClassNotFoundException: com.xxx.yyy.ZZZZApplication
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
```
I got the following error. ZZZZApplication is in classes2.dex.
```
06-08 10:45:07.624 9677-9677/com.xxx.yyy.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xxx.yyy.debug, PID: 9677
java.lang.RuntimeException: Unable to instantiate application com.xxx.yyy.ZZZZApplication: java.lang.ClassNotFoundException: Didn't find class "com.xxx.yyy.ZZZZApplication" on path: DexPathList[[zip file "/data/app/com.xxx.yyy.debug-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:563)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4491)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xxx.yyy.ZZZZApplication" on path: DexPathList[[zip file "/data/app/com.xxx.yyy.debug-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newApplication(Instrumentation.java:979)
at android.app.LoadedApk.makeApplication(LoadedApk.java:558)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4491)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Suppressed: java.lang.NoClassDefFoundError: com.xxx.yyy.ZZZZApplication
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:321)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 14 more
Suppressed: java.lang.ClassNotFoundException: com.xxx.yyy.ZZZZApplication
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
```
ke...@gmail.com <ke...@gmail.com> #16
#15 Sorry, I mistake the account. I wrote #15
li...@gmail.com <li...@gmail.com> #17
I found the cause of the problem,when i set "minifyEnabled false" is ok ,but i set "minifyEnabled true" is happened this error; gradle plugin 3.4.1 #14
li...@gmail.com <li...@gmail.com> #18
when i build release-apk #17
da...@robinhood.com <da...@robinhood.com> #19
Beta-04 has not fixed the issue for us either.
ga...@google.com <ga...@google.com> #20
Location of Application class does not matter for API 21+ as multidex is supported natively. Screenshots from #4 and comment from #8 clearly indicated that having too many dex files in the APK is the root cause of this issue.
Re #15, #19: Can you please upload an APK built with 3.5.0-beta04 or check how many dex files it has? You can also email it to gavra@google.com if you don't want to upload it here.
Re #17: ClassNotFoundException can happen because of many reasons. Unless you see 100s of DEX files in your APK, the root cause is most likely not as in #1. Please file a new issue with sample project/repro steps.
Re #15, #19: Can you please upload an APK built with 3.5.0-beta04 or check how many dex files it has? You can also email it to gavra@google.com if you don't want to upload it here.
Re #17: ClassNotFoundException can happen because of many reasons. Unless you see 100s of DEX files in your APK, the root cause is most likely not as in #1. Please file a new issue with sample project/repro steps.
ga...@google.com <ga...@google.com> #21
I am sorry, I misread the version of the Android Gradle plugin where this issue is fixed. The reason why you are still seeing the issue is because the fix hasn't been published yet :facepalm:
Here are the version where the fix will land:
- For 3.5, it will be fixed in 3.5.0-beta05.
- For 3.6, it will be fixed in 3.6.0-alpha04
Here are the version where the fix will land:
- For 3.5, it will be fixed in 3.5.0-beta05.
- For 3.6, it will be fixed in 3.6.0-alpha04
li...@gmail.com <li...@gmail.com> #22
When can I use 3.5.0-beta05? #21
ga...@google.com <ga...@google.com> #23
I am sorry, but I cannot provide you with that information. We have a team policy against publicly committing to release dates. I can only tell you that we are working on final bits for 3.5.0-beta05 and that it should be out soon.
li...@gmail.com <li...@gmail.com> #24
thanks! #23
ke...@gmail.com <ke...@gmail.com> #25
Working in 3.5.0-beta05. Thanks!
rk...@google.com <rk...@google.com> #26
The root cause from perf-plugin
side has been fixed (internally tracked at
Description
This error occurs on API 21 or 22 device. Others don't.
My project configuration is here.
- AGP 3.5.0-beta01
- Using Kotlin
- Using Multidex
- Add package name suffix when debugging
I'm not sure but I find a solution to run the app. When adding `debuggable false ` to build.gradle, the app is running normally. But, we cannot debug with breakpoint.
Sorry, I cannot attach our project and cannot be public. If you want to more information, ask me anything.
Error log is here.
```
05-16 16:35:05.987 30050-30050/com.xxxx.yyyy.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xxxx.yyyy.debug, PID: 30050
java.lang.RuntimeException: Unable to instantiate application com.xxxx.yyyy.ZZZZApplication: java.lang.ClassNotFoundException: Didn't find class "com.xxxx.yyyy.ZZZZApplication" on path: DexPathList[[zip file "/data/app/com.xxxx.yyyy.debug-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:563)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4491)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xxxx.yyyy.ZZZZApplication" on path: DexPathList[[zip file "/data/app/com.xxxx.yyyy.debug-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newApplication(Instrumentation.java:979)
at android.app.LoadedApk.makeApplication(LoadedApk.java:558)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4491)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Suppressed: java.lang.NoClassDefFoundError: com.xxxx.yyyy.ZZZZApplication
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:321)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 14 more
Suppressed: java.lang.ClassNotFoundException: com.xxxx.yyyy.ZZZZApplication
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
```
Build: AI-191.6707.61.35.5529924, 201905031752,
AI-191.6707.61.35.5529924, JRE 1.8.0_202-release-1483-b01x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.14.4, screens 1920x1080, 1440x900; Retina
AS: 3.5 Beta 1; Android Gradle Plugin: 3.5.0-beta01; Gradle: 5.4; NDK: from local.properties: 19.2.5345600, latest from SDK: 19.2.5345600; LLDB: LLDB 3.1 (revision: 3.1.4508709); CMake: from local.properties: (not specified), latest from SDK: 3.10.2, from PATH: (not found)
IMPORTANT: Please read