我已将Fabric添加到我的应用中。但是在某些设备中,当我打开应用程序时,我会提出错误。我已在应用程序中添加了Multidex。
FATAL EXCEPTION: main
Process: ru.mitapp.dist_android, PID: 15828
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/crashlytics/android/core/CrashlyticsCore;
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:29)
at ru.mitapp.dist_android.App.onCreate(App.java:97)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4793)
at android.app.ActivityThread.access$1900(ActivityThread.java:152)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5538)
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:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.crashlytics.android.core.CrashlyticsCore" on path: DexPathList[[zip file "/data/app/ru.mitapp.dist_android-1/base.apk"],nativeLibraryDirectories=[/data/app/ru.mitapp.dist_android-1/lib/arm64, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 13 more
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
在我的朋友中: (堆问写那么SL东西; dkfsa; dkfa; sdknfasdfasdf; SND; flnasldfnlsdfnlksajdnflkasjdnflkasjdnflksajdnflkasjdnflsajdnfklasdhfksadjfkhsadfksahdflksahdflkjsadhflkasjhdflksajdhfkljsadhflksajdhflaksjdhflasjkdhfljksda)。请原谅我此
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
repositories {
mavenCentral()
}
apply plugin: 'realm-android'
android {
compileSdkVersion 26
defaultConfig {
applicationId "ru.mitapp.dist_android"
minSdkVersion 21
targetSdkVersion 26
versionCode 20
versionName "1.0.20"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
compile 'com.github.IntruderShanky:Sectioned-RecyclerView:2.1.1'
//rxJava/rxAndroid/retrofit
implementation 'com.google.firebase:firebase-core:11.0.4'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
compile 'io.reactivex.rxjava2:rxjava:2.1.5'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
//picasso/downloaderPicasso
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
//ButterKnife
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
//section RecyclerView
compile 'com.github.IntruderShanky:Sectioned-RecyclerView:2.1.1'
//navigationBottom
compile 'com.github.ittianyu:BottomNavigationViewEx:1.2.4'
implementation 'com.google.android.gms:play-services:11.0.4'
compile 'com.google.maps.android:android-maps-utils:0.4+'
//Surface scan
//noinspection UseOfBundledGooglePlayServices
// compile 'com.google.android.gms:play-services:11.0.4'
//mask for enter phone number
implementation 'ru.egslava:MaskedEditText:1.0.5'
//cirler photo
compile 'de.hdodenhof:circleimageview:2.2.0'
//maskEditTask
compile 'com.github.pinball83:masked-edittext:1.0.3'
//bage
compile 'q.rorbin:badgeview:1.1.0'
//calendar
compile 'com.prolificinteractive:material-calendarview:1.4.3'
compile 'com.github.lzyzsd:circleprogress:1.2.1'
compile 'com.github.darsh2:MultipleImageSelect:v0.0.4'
compile 'com.github.rampo.updatechecker:library:2.1.8'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true
exclude group: 'com.android.support', module: 'support-annotations'
}
compile 'com.android.support:multidex:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
在我的申请中:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
@Override
public void onCreate() {
super.onCreate();
MultiDex.install(this);
context = getApplicationContext();
Realm.init(this);
final RealmConfiguration configuration = new RealmConfiguration
.Builder()
.name(Realm.DEFAULT_REALM_NAME)
.schemaVersion(9)
.migration(new TasksMigration())
.build();
Realm.setDefaultConfiguration(configuration);
Fabric.with(context, new Crashlytics());
And some retofit code...}
当我在调试中安装到设备时,它可以正常工作,但是如果我从playMarket下载它,那么它就会崩溃