There is a problem in our released app that is driving us crazy.
The app has run smoothly for the last two years in Google Play. We updated Android Studio and some libraries weeks ago and the "Android Vitals" shows a lot of errors since then. The app, as far we know, is NOT crashing (the app has a lot of reviews and none of them refers to a crash problem). Have tested it in a lot of devices with successful results.
The "crash" is reported by all kind of devices (Samsung Galaxy, HTC, Sony, etc.) and all kind of versions (Android 4, 5, 6, 7).
All the "crashes" are notified like this:
java.lang.RuntimeException:
at android.app.ActivityThread.handleReceiver (ActivityThread.java:2739)
at android.app.ActivityThread.access$1900 (ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1452)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:5523)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:739)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:629)
Caused by: java.lang.ClassNotFoundException:
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.ActivityThread.handleReceiver (ActivityThread.java:2734)
I don't have any clue about whats happening. Is there anything to do with MultiDex? We got some problems with MultiDex building the apk since Android Studio was updated, seems like Android Studio cache is not working properly with classes.dex (classes.dex got smaller size than classes2.dex, to fix this we have to change multiDex config once, rebuild, change multiDex config again to the right parameters and rebuild one more time).
This is the gradle config:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
sourceSets.main {
java.srcDir "src"
res.srcDir "res"
jniLibs.srcDir "libs"
manifest.srcFile "AndroidManifest.xml"
assets.srcDir "assets"
}
dexOptions {
javaMaxHeapSize "4g"
incremental false
jumboMode false
preDexLibraries false
}
signingConfigs {
...
}
buildTypes {
release {
signingConfig signingConfigs.release
debuggable false
jniDebuggable false
renderscriptDebuggable false
minifyEnabled false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
...
}
configurations {
provided
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
...
}
Manifest is configured for MultiDex:
<application
android:allowBackup="true"
android:name="android.support.multidex.MultiDexApplication"
android:icon="@mipmap/ic_launcher">
...
Help please!!