Fixed
Status Update
Comments
xa...@google.com <xa...@google.com>
ch...@google.com <ch...@google.com>
al...@google.com <al...@google.com>
th...@gmail.com <th...@gmail.com> #2
Adding "api 'com.android.support:multidex:1.0.2'" to the application module fixes the issue. But adding "implementation 'com.android.support:multidex:1.0.2'" doesn't.
[Deleted User] <[Deleted User]> #3
Can you please share your build.gradle files (for application and android library), as I am unable to reproduce?
From the screenshot, classes8.dex contains only references to the MultiDexApplication, it does not contain definitions of the class. If you execute `dexdump <path_to_apk>` are you able to see the definition of MultiDexApplication?
From the screenshot, classes8.dex contains only references to the MultiDexApplication, it does not contain definitions of the class. If you execute `dexdump <path_to_apk>` are you able to see the definition of MultiDexApplication?
ch...@google.com <ch...@google.com> #4
See attachments for more info.
mo...@gmail.com <mo...@gmail.com> #5
The difference when building from Studio is that we take into consideration the API of the device you are deploying to, so we might change legacy multidex build to a native multidex one. It looks like the device you are deploying to has API 25, so that is why APK differs when building from the command line and when building from the IDE. In legacy multidex we have requirements due to DalvikVM which classes are in the main dex, and that's why MultiDexApplication is in the classes.dex. However, for native multidex, ART is able to load classes from any classes<N>.dex file. So it is strange that the runtime is unable to find MultiDexApplication, when it's clearly in classes13.dex.
What is the device that you are trying to deploy the app to? From the screenshots it looks like it's a Chromebook?
What is the device that you are trying to deploy the app to? From the screenshots it looks like it's a Chromebook?
ke...@gmail.com <ke...@gmail.com> #6
I tested if the Chromebook was the issue by trying the same on the Nexus 6P running Oreo. And the Nexus 6P has the same issue.
The logcat says:
09-06 11:33:09.672 10942-10942/? E/dex2oat: Failed to open dex file from oat file. File: base.apk:classes8.dex Error: Failure to verify dex file 'base.apk:classes8.dex': Non-zero padding 65 before section start at ace
09-06 11:33:09.678 20659-10988/? I/CheckinUtil: Classify the device as Phone.
09-06 11:33:09.686 10942-10942/? I/dex2oat: dex2oat took 754.758ms (472.528ms cpu) (threads: 4)
09-06 11:33:09.693 581-23895/? E/installed: DexInv: --- END '/data/app/vmdl1021122682.tmp/base.apk' --- status=0x0100, process failed
09-06 11:33:09.694 581-23895/? E/installd: Failed to dexopt (256)
09-06 11:33:09.695 795-829/? W/PackageManager.DexOptimizer: Failed to dexopt
com.android.server.pm.Installer$InstallerException: android.os.ServiceSpecificException: Failed to dexopt (code 256)
at com.android.server.pm.Installer.dexopt(Installer.java:290)
at com.android.server.pm.PackageDexOptimizer.dexOptPath(PackageDexOptimizer.java:220)
at com.android.server.pm.PackageDexOptimizer.performDexOptLI(PackageDexOptimizer.java:175)
at com.android.server.pm.PackageDexOptimizer.performDexOpt(PackageDexOptimizer.java:123)
at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.java:18185)
at com.android.server.pm.PackageManagerService.installPackageTracedLI(PackageManagerService.java:17780)
at com.android.server.pm.PackageManagerService.-wrap33(Unknown Source:0)
at com.android.server.pm.PackageManagerService$6.run(PackageManagerService.java:15251)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
09-06 11:33:09.701 795-810/? I/ActivityManager: Force stopping com.visiolink.reader.wrapper appid=10264 user=-1: installPackageLI
See the attached file for the complete logcat.
I think it might be a 3. party library causing the issue. I will try to remove it and see what happens.
The logcat says:
09-06 11:33:09.672 10942-10942/? E/dex2oat: Failed to open dex file from oat file. File: base.apk:classes8.dex Error: Failure to verify dex file 'base.apk:classes8.dex': Non-zero padding 65 before section start at ace
09-06 11:33:09.678 20659-10988/? I/CheckinUtil: Classify the device as Phone.
09-06 11:33:09.686 10942-10942/? I/dex2oat: dex2oat took 754.758ms (472.528ms cpu) (threads: 4)
09-06 11:33:09.693 581-23895/? E/installed: DexInv: --- END '/data/app/vmdl1021122682.tmp/base.apk' --- status=0x0100, process failed
09-06 11:33:09.694 581-23895/? E/installd: Failed to dexopt (256)
09-06 11:33:09.695 795-829/? W/PackageManager.DexOptimizer: Failed to dexopt
com.android.server.pm.Installer$InstallerException: android.os.ServiceSpecificException: Failed to dexopt (code 256)
at com.android.server.pm.Installer.dexopt(Installer.java:290)
at com.android.server.pm.PackageDexOptimizer.dexOptPath(PackageDexOptimizer.java:220)
at com.android.server.pm.PackageDexOptimizer.performDexOptLI(PackageDexOptimizer.java:175)
at com.android.server.pm.PackageDexOptimizer.performDexOpt(PackageDexOptimizer.java:123)
at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.java:18185)
at com.android.server.pm.PackageManagerService.installPackageTracedLI(PackageManagerService.java:17780)
at com.android.server.pm.PackageManagerService.-wrap33(Unknown Source:0)
at com.android.server.pm.PackageManagerService$6.run(PackageManagerService.java:15251)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
09-06 11:33:09.701 795-810/? I/ActivityManager: Force stopping com.visiolink.reader.wrapper appid=10264 user=-1: installPackageLI
See the attached file for the complete logcat.
I think it might be a 3. party library causing the issue. I will try to remove it and see what happens.
ch...@google.com <ch...@google.com> #7
Logcat was missing in #6
ke...@gmail.com <ke...@gmail.com> #8
It is this library that causes the issue:
https://github.com/chartbeat-labs/android_sdk
The library is initialized in Application.onCreate.
From the multidex docs:
Caution: Do not execute MultiDex.install() or any other code through reflection or JNI before MultiDex.install() is complete. Multidex tracing will not follow those calls, causing ClassNotFoundException or verify errors due to a bad class partition between DEX files.
So this library must be loading through reflection. But when is attachBaseContext called in relation to onCreate? And why does having the multidex dependency in the application module fix the issue?
The library is initialized in Application.onCreate.
From the multidex docs:
Caution: Do not execute MultiDex.install() or any other code through reflection or JNI before MultiDex.install() is complete. Multidex tracing will not follow those calls, causing ClassNotFoundException or verify errors due to a bad class partition between DEX files.
So this library must be loading through reflection. But when is attachBaseContext called in relation to onCreate? And why does having the multidex dependency in the application module fix the issue?
ch...@google.com <ch...@google.com> #9
I don't even need to initialize it. It fails just be including it as a dependency in the application module:
implementation 'com.chartbeat:sdk:1.3.4'
implementation 'com.chartbeat:sdk:1.3.4'
ke...@gmail.com <ke...@gmail.com> #10
When running on Android N and above, MultiDex.install() is a no-op, so that is not where to problem is coming from.
However, your classes8.dex is corrupt, and all classes from classes8, 9, 10 etc will not be loaded. Considering that MultiDex is in classes13.dex, exception is thrown. When you add the multidex suppor library directly, we just end up packaging dex files in a way that does not break dex2oat.
This issue might be in the dex merger. Can you add android.useDexArchive=false to gradle.properties? After that, can you set android.useDexArchive=true and add android.enableD8=true?
However, your classes8.dex is corrupt, and all classes from classes8, 9, 10 etc will not be loaded. Considering that MultiDex is in classes13.dex, exception is thrown. When you add the multidex suppor library directly, we just end up packaging dex files in a way that does not break dex2oat.
This issue might be in the dex merger. Can you add android.useDexArchive=false to gradle.properties? After that, can you set android.useDexArchive=true and add android.enableD8=true?
ch...@google.com <ch...@google.com> #11
android.useDexArchive=false => Fixes the issue
android.useDexArchive=true, android.enableD8=true: => Also fixes the issue.
android.useDexArchive=true, android.enableD8=true: => Also fixes the issue.
Description
Build #AI-171.4333198, built on September 13, 2017
JRE: 1.8.0_152-release-915-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6
Version of Gradle Plugin: 2.3.3
Version of Gradle: 4.1
Steps to Reproduce (cd attachments - demodep.zip) :
1. Android app depends on Android library depends on Java library
2. The Java library depends on some Java libraries (f.e. : Kotlin, Gson)
Problems :
1. AS reports that Kotlin is not configured.
2. In the IDE, the dependencies of the Java library are not found neither in the app nor in the Android library.
Remarks :
- The app can be compiled and run without errors.
- If I use the Gradle Plugin 3.0.0-beta6 : no more issues