当您在API 23-27上运行我的应用程序时,它运行良好,但在API 21和22上崩溃,并显示以下错误:我尝试了很多问题,但仍然不满意
这是具有相同issuse的链接,但对我没有帮助
Didn't find class "com.google.firebase.provider.FirebaseInitProvider"?
错误
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/kc.care.task-1/base.apk"],nativeLibraryDirectories=[/data/app/kc.care.task-1/lib/arm64, /vendor/lib64, /system/lib64]]
at android.app.ActivityThread.installProvider(ActivityThread.java:5358)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4926)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4860)
at android.app.ActivityThread.access$1400(ActivityThread.java:183)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5667)
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:962)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/kc.care.task-1/base.apk"],nativeLibraryDirectories=[/data/app/kc.care.task-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)
at android.app.ActivityThread.installProvider(ActivityThread.java:5343)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4926)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4860)
at android.app.ActivityThread.access$1400(ActivityThread.java:183)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5667)
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:962)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Suppressed: java.lang.ClassNotFoundException: com.google.firebase.provider.FirebaseInitProvider
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)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
我的 gradle 文件
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "kc.care.task"
minSdkVersion 21
targetSdkVersion 27
versionCode 73
versionName "7.4"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
sourceSets {
main {
assets.srcDirs = ['assets']
}
}
buildTypes {
release {
multiDexKeepFile file('multidex-config.txt')
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
repositories {
maven { url "https://jitpack.io" }
maven { // this is for realm-db
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(':materiallettericon')
compile 'com.github.PhilJay:MPAndroidChart-Realm:v2.0.2@aar'
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support:design:27.1.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-vector-drawable:27.1.1'
compile 'com.android.support:support-v4:27.1.1'
compile 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.android.support:cardview-v7:27.1.1'
compile 'com.felipecsl:gifimageview:2.1.0'
compile 'com.firebaseui:firebase-ui-database:3.0.0'
compile 'com.firebaseui:firebase-ui-auth:4.0.0'
compile 'commons-io:commons-io:2.4'
compile 'com.android.support:multidex:1.0.3'
compile 'com.google.firebase:firebase-core:16.0.3'
compile 'com.google.firebase:firebase-auth:16.0.3'
compile 'com.google.firebase:firebase-database:16.0.1'
compile 'com.google.firebase:firebase-firestore:17.1.0'
compile 'com.google.firebase:firebase-messaging:17.3.0'
compile 'com.google.firebase:firebase-storage:16.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
compile 'com.google.android.gms:play-services-places:15.0.1'
compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-analytics:16.0.3'
compile 'com.google.android.gms:play-services-gcm:15.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.zoho:deskportalsdk:0.822'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5@aar'
compile 'com.hbb20:ccp:2.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'