In a debug version app works fine. But when I generate sign apk and install this, after open app - it immediately crashes due to a logcat error:
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mypackage.AppClass" on path: DexPathList[[zip file "/data/app/com.mypackage-1/base.apk"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]].
I use AppClass to extends MultiDexApplication and I've got there some functions also. I have declared this class correctly in a manifest.
The most complicated is that it works in a debug version but only in release version this problem occurs.
I would be really grateful if someone could help me to resolve this situation.
Regards
Finally, I found a solution which helped me to resolve this problem. I had to add this part of code in a gradle:
dexOptions {
preDexLibraries = false
}
And the following to the general part of your apps build.gradle
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = ['--multi-dex']
} else {
dx.additionalParameters += '--multi-dex'
}
}
}
For the others who can have similar issue I'm referring to a post in which I obtained a solution: https://stackoverflow.com/a/26627133/5736917