从 Fabric Crashlytics 更新后,Firebase Crashlytics 在运行时崩溃
Firebase Crashlytics Crashed in runtime after Updated From Fabric Crashlytics
我已将 Fabric Crashlytic 迁移到 Firebase Crashlytics。现在应用程序在 运行 时间
后崩溃
Process: com.treinetic.whiteshark, PID: 29371
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.IllegalStateException: The Crashlytics build ID is missing. This occurs when Crashlytics tooling is absent from your app's build configuration. Please review Crashlytics onboarding instructions and ensure you have a valid Crashlytics account.
at android.app.ActivityThread.installProvider(ActivityThread.java:6537)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6025)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5931)
at android.app.ActivityThread.access00(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1673)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
我的Gradle是这样的
项目级别build.gradle
buildscript {
ext.kotlin_version = '1.3.11'
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用级别build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.myapp.app"
minSdkVersion 21
targetSdkVersion 29
versionCode 15
versionName "1.1.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
ext.enableCrashlytics = false
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
dataBinding {
enabled = true
}
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/core_release.kotlin_module'
exclude 'META-INF/MyApplication_debug.kotlin_module'
exclude 'META-INF/appname_debug.kotlin_module'
exclude 'META-INF/appname_debug.kotlin_module'
exclude 'META-INF/appname_release.kotlin_module'
exclude 'META-INF/appname_debug.kotlin_module'
}
testOptions {
unitTests.returnDefaultValues = true
// unitTests {
// includeAndroidResources = true
// }
sourceSets {
test {
resources.srcDirs += ['src/test/resources']
}
androidTest {
resources.srcDirs += ['src/androidTest/resources']
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'com.google.android.material:material:1.1.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'com.android.support:multidex:1.0.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha01'
//FIREBASE
implementation 'com.google.firebase:firebase-auth:19.3.1'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-messaging:20.2.1'
// implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-crashlytics:17.0.0'
implementation 'com.google.firebase:firebase-analytics:17.4.2'
//GLIDE
implementation 'com.github.bumptech.glide:glide:4.9.0'
kapt 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
def multidex_version = "2.0.1"
implementation "androidx.multidex:multidex:$multidex_version"
def lifecycle_version = "2.0.0"
// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
//ROOM DATABASE
def room_version = "2.0.0-beta01"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
.....
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
崩溃后再次部署成功。但是当我再次部署时它崩溃了。这是一个循环。第一次部署-> 崩溃第二次部署-> 工作正常
我想 运行 应用程序每次都没有任何 运行 时间崩溃。我找不到任何问题。我已删除 maven { url 'https://maven.fabric.io/public' }
并测试该应用程序,但结果相同。没有改变。我还清理了项目并完成了使缓存无效并重新启动但没有工作。我正在寻找解决方案。请帮助
从您的 build.gradle
中删除 ext.enableCrashlytics = false
。
如果您不想为调试版本上传映射文件,请使用:
debug {
minifyEnabled true
firebaseCrashlytics {
mappingFileUploadEnabled false
}
}
要为您的调试版本禁用 Crashlytics,请将此添加到您的应用程序 class:
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(!BuildConfig.DEBUG)
我已将 Fabric Crashlytic 迁移到 Firebase Crashlytics。现在应用程序在 运行 时间
后崩溃Process: com.treinetic.whiteshark, PID: 29371
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.IllegalStateException: The Crashlytics build ID is missing. This occurs when Crashlytics tooling is absent from your app's build configuration. Please review Crashlytics onboarding instructions and ensure you have a valid Crashlytics account.
at android.app.ActivityThread.installProvider(ActivityThread.java:6537)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6025)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5931)
at android.app.ActivityThread.access00(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1673)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
我的Gradle是这样的
项目级别build.gradle
buildscript {
ext.kotlin_version = '1.3.11'
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用级别build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.myapp.app"
minSdkVersion 21
targetSdkVersion 29
versionCode 15
versionName "1.1.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
ext.enableCrashlytics = false
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
dataBinding {
enabled = true
}
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/core_release.kotlin_module'
exclude 'META-INF/MyApplication_debug.kotlin_module'
exclude 'META-INF/appname_debug.kotlin_module'
exclude 'META-INF/appname_debug.kotlin_module'
exclude 'META-INF/appname_release.kotlin_module'
exclude 'META-INF/appname_debug.kotlin_module'
}
testOptions {
unitTests.returnDefaultValues = true
// unitTests {
// includeAndroidResources = true
// }
sourceSets {
test {
resources.srcDirs += ['src/test/resources']
}
androidTest {
resources.srcDirs += ['src/androidTest/resources']
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'com.google.android.material:material:1.1.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'com.android.support:multidex:1.0.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha01'
//FIREBASE
implementation 'com.google.firebase:firebase-auth:19.3.1'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-messaging:20.2.1'
// implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-crashlytics:17.0.0'
implementation 'com.google.firebase:firebase-analytics:17.4.2'
//GLIDE
implementation 'com.github.bumptech.glide:glide:4.9.0'
kapt 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
def multidex_version = "2.0.1"
implementation "androidx.multidex:multidex:$multidex_version"
def lifecycle_version = "2.0.0"
// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
//ROOM DATABASE
def room_version = "2.0.0-beta01"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
.....
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
崩溃后再次部署成功。但是当我再次部署时它崩溃了。这是一个循环。第一次部署-> 崩溃第二次部署-> 工作正常
我想 运行 应用程序每次都没有任何 运行 时间崩溃。我找不到任何问题。我已删除 maven { url 'https://maven.fabric.io/public' }
并测试该应用程序,但结果相同。没有改变。我还清理了项目并完成了使缓存无效并重新启动但没有工作。我正在寻找解决方案。请帮助
从您的 build.gradle
中删除 ext.enableCrashlytics = false
。
如果您不想为调试版本上传映射文件,请使用:
debug {
minifyEnabled true
firebaseCrashlytics {
mappingFileUploadEnabled false
}
}
要为您的调试版本禁用 Crashlytics,请将此添加到您的应用程序 class:
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(!BuildConfig.DEBUG)