由于Fabric Crashlytics,我遇到了一个奇怪的崩溃.
我正在使用面料的崩解剂.但是当我在S5 5.0 API 21上运行应用程序时,它会崩溃整个应用程序.
请参阅以下报告:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/crashlytics/android/core/Crashlyticscore;
at com.crashlytics.android.Crashlytics.score" 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.score
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但仍有一些问题.
最佳答案
这种错误通常与MultiDex的使用有关
看看你的代码并验证(特别是第2点):
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
}