I have a problem while integrating Dexguard in the projects that needs to enable Multidex, I get no compile errors but when launching the app it crashes with this error
java.lang.RuntimeException: Unable to instantiate application xx.xxx.xxx.XXXApp: java.lang.ClassNotFoundException: Didn't find class "xx.xxx.xxx.XXXApp" on path: DexPathList
This is the app.gradle file:
apply plugin: 'com.android.application'
...
apply plugin: 'dexguard'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "xx.xxx.xxx"
...
multiDexEnabled true
}
buildTypes {
debug {
proguardFile getDefaultDexGuardFile('dexguard-debug.pro')
proguardFile 'dexguard-project.txt'
//proguardFile 'proguard-project.txt'
}
release {
proguardFile getDefaultDexGuardFile('dexguard-release.pro')
proguardFile 'dexguard-project.txt'
//proguardFile 'proguard-project.txt'
}
}
flavorDimensions "server"
productFlavors {
dev {
applicationIdSuffix ".dev"
dimension "server"
}
...
prod {
dimension "server"
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
...
implementation 'com.android.support:multidex:1.0.1'
//support libraries
...
//play services
...
//architecture components
...
//others
...
}
apply plugin: 'com.google.gms.google-services'
In the dexguard-project.txt file I simply added the -multidex
option
I also tried using -keep public class * extends android.app.Application
but without luck.
EDIT
I use a custom application class that extends another custom one -.- so I added the snippet below
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
And this is the relative part of the manifest
<application
android:name=".XXXApp"
...
Anybody has faced the same issue?