Reputation: 3869
As I have reached the 64K Methods limit I have activated Multidex in my app.
I'm testing on 2 different devices:
Everything works find on the first one but on the second one I get these errors and the entire app freeze (doesn't crash).
Errors
E/dalvikvm: Could not find class 'android.app.job.JobScheduler', referenced from method com.google.android.gms.internal.zzcfr.zzazv
E/dalvikvm: Could not find class 'android.app.job.JobScheduler', referenced from method com.google.android.gms.internal.zzcfr.zzs
E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
I followed the documentation so:
In my gradle I have added:
multiDexEnabled true
compile 'com.android.support:multidex:1.0.1'
as I'm targetting API 16 as minSDKVersionIn my custom Application class
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
To try to fix the issue I've created a multidex-config.txt
file that is in the same folder as the build.gradle where it is referenced.
multidex-config.txt (EDITED)
android/app/job/JobScheduler.class
android/support/v4/widget/DrawerLayout.class
android/graphics/drawable/RippleDrawable.class
then in the gradle:
buildTypes {
debug {
multiDexKeepFile file('multidex-config.txt')
//...
}
debugStaging {
initWith(buildTypes.debug)
//...
}
release {
multiDexKeepFile file('multidex-config.txt')
minifyEnabled false
//...
}
}
I think I've missed something. Any clue?
Gradle file
android {
compileSdkVersion 26
defaultConfig {
//...
minSdkVersion 16
targetSdkVersion 25
multiDexEnabled true
versionCode 10
//...
}
buildTypes {
//...
debug {
//...
multiDexKeepFile file('multidex-config.txt')
}
debugStaging {
initWith(buildTypes.debug)
//...
}
release {
//...
multiDexKeepFile file('multidex-config.txt')
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//...
}
}
dexOptions {
maxProcessCount 6
javaMaxHeapSize "2g"
jumboMode true
}
//...
}
ext {
//...
}
dependencies {
//...
implementation 'com.android.support:multidex:1.0.2'
//...
}
// Required by Firebase
apply plugin: 'com.google.gms.google-services'
Upvotes: 4
Views: 2505
Reputation: 1167
The format of the multidex-config.txt seems different from the one described in Android Documentation.
It seems like the -keep should not be here. Its part of multiDexKeepProguard not multiDexKeepFile
The format should be
com/example/MyClass.class
com/example/MyOtherClass.class
Since the Alps A733 is having API 19, (any app having API level less than 20), your app crashes with the error java.lang.NoClassDefFoundError.
Upvotes: 1