由于Fabric Crashlytics,我遇到了一个奇怪的崩溃。 我正在使用面料的崩解剂。但是当我在S5 5.0 API 21上运行应用程序时,它会崩溃整个应用程序。
请参阅以下报告:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/crashlytics/android/core/CrashlyticsCore;
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:29)
at com.projectname.application.AppData.onCreate(AppData.java:162)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5010)
at android.app.ActivityThread.access$1600(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1482)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.crashlytics.android.core.CrashlyticsCore" on path: DexPathList[[zip file "/data/app/com.projectname-2/base.apk", zip file "/data/app/com.projectname-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.projectname-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.packagename-here-2/lib/arm, /vendor/lib, /system/lib]]
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 com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:29)
at com.packagename--here.application.AppData.onCreate(AppData.java:162)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5010)
at android.app.ActivityThread.access$1600(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1482)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Suppressed: java.lang.ClassNotFoundException: com.crashlytics.android.core.CrashlyticsCore
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 14 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
这是我的gradle文件:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
maven {
url "https://jitpack.io"
maven { url 'https://github.com/500px/500px-android-blur/raw/master/releases/' }
}
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'android-apt'
android {
lintOptions {
disable 'MissingTranslation'
checkReleaseBuilds false
}
packagingOptions {
exclude 'META-INF/rxjava.properties'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "--package--name"
minSdkVersion 19
targetSdkVersion 25
versionCode 23
versionName "2.6"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:multidex:1.0.1'
compile 'com.jakewharton:butterknife:8.4.0'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
// retrofit, gson
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.angads25:filepicker:1.0.6'
compile 'io.reactivex:rxjava:1.0.16'
// Progress loader
compile 'com.wang.avi:library:2.1.3'
//Stetho debug
compile 'com.facebook.stetho:stetho:1.4.2'
//Stetho OkHttp3
//compile 'com.facebook.stetho:stetho-okhttp3:1.4.2'
compile project(':facebook-android-sdk-4.16.1')
compile project(':linkedin-sdk')
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true;
}
compile 'com.google.android.gms:play-services:9.8.0'
// image picker
compile 'com.github.darsh2:MultipleImageSelect:3474549'
// instabug
compile 'com.instabug.library:instabug:3+'
compile 'com.github.recruit-lifestyle:WaveSwipeRefreshLayout:1.6'
compile 'com.facebook.fresco:fresco:1.3.0'
compile 'com.borjabravo:readmoretextview:2.0.1'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
compile project(':versioninfo')
}
apply plugin: 'com.google.gms.google-services'
每当发布时,应用程序都会崩溃 我也尝试过multidex但仍存在一些问题。
答案 0 :(得分:3)
这种错误通常与MultiDex的使用有关
查看您的代码并验证(特别是第2点):
1)您已将multidex支持添加到您的应用中:
compile 'com.android.support:multidex:1.0.1'
2)您已将应用程序设置为MultiDex应用程序
public class MyApplication extends Application {
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
// Your application implementation here
}
3)您已将multiDexEnabled true设置添加到build.gradle文件中:
defaultConfig {
// Other settings here
multiDexEnabled true
}