On my latest release a few of my users (less than 0.2%) are getting a crash because android.support.v7.app.AppCompatDelegateImplV23
can not be found. I can not reproduce the issue, I'm only getting reports over crashlytics. I have used apktool to extract the files out of my apk and I can see AppCompatDelegateImplV23.smali
in there. Any idea what could be happening?
This is my compile line on gradle:
compile 'com.android.support:appcompat-v7:23+'
This is the exception:
Fatal Exception: java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV23
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:133)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:117)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:456)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
at MyActivityClass.onCreate(MyActivityClass.java:353)
at android.app.Activity.performCreate(Activity.java:6248)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
at android.app.ActivityThread.access$900(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:168)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:117)
EDIT: This is my main gradle file:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter() // version plugin support
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.android.tools.build:gradle:1.3.1'
}
allprojects {
repositories {
jcenter()
}
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
signingConfigs {
config {
......
}
}
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'
productFlavors {
// Define separate dev and prod product flavors.
dev {
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
// to pre-dex each module and produce an APK that can be tested on
// Android Lollipop without time consuming dex merging processes.
minSdkVersion 21
}
prod {
// The actual minSdkVersion for the application.
minSdkVersion 14
}
}
defaultConfig {
applicationId "mypackage"
minSdkVersion 14
targetSdkVersion 23
versionCode some number
versionName "some version number"
multiDexEnabled true
signingConfig signingConfigs.config
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(output.outputFile.parent,"myapk.apk")
}
}
}
debug {
signingConfig signingConfigs.config
}
}
repositories {
mavenCentral()
mavenLocal()
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'AndroidManifest.xml'
exclude 'META-INF/beans.xml'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
}
productFlavors {
}
dexOptions {
// preDexLibraries = false
jumboMode = true
javaMaxHeapSize "2g"
//doesn't seem to be supported with multidex
// incremental true
}
lintOptions{
disable 'MissingTranslation'
disable 'ExtraTranslation'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//multidex
compile 'com.android.support:multidex:1.0.0'
//support libs
compile 'com.android.support:support-v4:23+'
compile 'com.android.support:appcompat-v7:23+'
compile 'com.android.support:cardview-v7:23+'
compile 'com.android.support:design:23+'
//app invites
compile 'com.google.android.gms:play-services-appinvite:8+'
compile 'com.google.android.gms:play-services-analytics:8+'
//chromecast
compile 'com.google.android.gms:play-services-cast:8+'
compile 'com.android.support:mediarouter-v7:23+'
//plus button
compile 'com.google.android.gms:play-services-plus:8+'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
compile 'com.github.navasmdc:MaterialDesign:1.+@aar'
//material lib needs it
compile 'com.nineoldandroids:library:2.4.+'
compile 'com.facebook.stetho:stetho:1+'
compile 'com.facebook.stetho:stetho-okhttp:1+'
//debugCompile 'com.squareup.leakcanary:leakcanary-android:1+'
debugCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1+'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1+'
compile 'com.makeramen:dragsortadapter:1.3+'
compile 'com.github.amlcurran.showcaseview:library:5.0.0'
}
EDIT: just had a new report but for a different version of the same class
Fatal Exception: java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:135)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:117)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:456)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
at MyActivity.onCreate(MyActivity.java:353)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2044)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2105)
at android.app.ActivityThread.access$600(ActivityThread.java:133)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1211)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4795)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(NativeStart.java)
EDIT: I've just gone over a lot of the reports, some are for AppCompatDelegateImplV23
and some are for AppCompatDelegateImplV14
, some involved XPosed but most don't. The one thing that is common to all of them is that they are all for rooted phones.
First of all, we need to understand why java.lang.NoClassDefFoundError error occurs :
So the answer is that when there is a class file that your code depends on and it is present at compile time but not found at runtime. Look for differences in your build time and runtime classpaths.
So there are some options by that you can remove this error:
1) Make preDexLibraries to true:
dexOptions {
preDexLibraries = true
jumboMode = true
javaMaxHeapSize "2g"
//doesn't seem to be supported with multi dex
// incremental true
}
2) There may be the problem with the incremental build system. So try to try to remove your build folder from your project and Rebuild the project OR Right click on your project -> "Open module settings" -> Dependencies tab -> check if Export is checked for your library
3) You need to do more than just provide MultiDex support.
For more reference you can check the below link which has provided more advance understanding of multi dex.
https://developer.android.com/tools/building/multidex.html
4) Or at last you can add jar files of V7 into your project's libs folder and then add it your build System.
5) Also try removing the jar files as well as it still includes the com.android.support:support-v4:23+ as gradle has a repository where it downloads the jars delcared like compile 'compile 'com.android.support:appcompat-v7:23+'
Hope this can give you some clue about your error.
My guess is that the problem is due to the xposed framework. At the bottom of the stack trace, you can find that the zygote was started by the xposed framework.
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:117)
This means that the user is using a custom Android rom with the xposed framework installed. The framework is usually used to modify the behavior of the Android framework (and any app of course) code by injecting new code at run-time.
You can check how it works at: https://github.com/rovo89/XposedBridge/tree/art/app/src/main/java/de/robv/android/xposed
Since the code behavior can be altered in various degrees depending on what mods are installed via the xposed framework, I cannot pinpoint the exact cause of your exception. However, if all the stack traces you have got start with the XposedBrigde.main(), then I can say that your problem is due to the exposed framework or the mods installed via the framework.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With