当我在Android Studio中进行增量构建时,Firebase Crashlytics崩溃并显示"缺少Crashlytics构建ID"



我正在我的Android应用程序中添加Firebase Crashlytics。我认真遵守了https://firebase.google.com/docs/crashlytics/get-started?platform=android.

当我重建并运行应用程序(在Android Studio中(时,一切都很好,我能够收到崩溃报告。

但是:当我在Android Studio中对代码进行一些更改并重新运行应用程序时,它会崩溃,并显示以下报告。

07-25 17:30:40.916 24237 24237 E FirebaseCrashlytics: .
07-25 17:30:40.916 24237 24237 E FirebaseCrashlytics: .     |  |
07-25 17:30:40.916 24237 24237 E FirebaseCrashlytics: .     |  |
07-25 17:30:40.916 24237 24237 E FirebaseCrashlytics: .     |  |
07-25 17:30:40.916 24237 24237 E FirebaseCrashlytics: .    |  | /
07-25 17:30:40.916 24237 24237 E FirebaseCrashlytics: .        /
07-25 17:30:40.916 24237 24237 E FirebaseCrashlytics: .       /
07-25 17:30:40.916 24237 24237 E FirebaseCrashlytics: .      /
07-25 17:30:40.916 24237 24237 E FirebaseCrashlytics: .
07-25 17:30:40.916 24237 24237 E FirebaseCrashlytics: 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.
07-25 17:30:40.916 24237 24237 E FirebaseCrashlytics: .
07-25 17:30:40.916 24237 24237 E FirebaseCrashlytics: .      /
07-25 17:30:40.916 24237 24237 E FirebaseCrashlytics: .     /  
07-25 17:30:40.917 24237 24237 E FirebaseCrashlytics: .    /    
07-25 17:30:40.917 24237 24237 E FirebaseCrashlytics: .   / |  | 
07-25 17:30:40.917 24237 24237 E FirebaseCrashlytics: .     |  |
07-25 17:30:40.917 24237 24237 E FirebaseCrashlytics: .     |  |
07-25 17:30:40.917 24237 24237 E FirebaseCrashlytics: .
07-25 17:30:40.918 24237 24237 E AndroidRuntime: 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.
07-25 17:30:40.918 24237 24237 E AndroidRuntime: Caused by: 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.
07-25 17:30:40.918 24237 24237 E AndroidRuntime:        at com.google.firebase.crashlytics.internal.common.CrashlyticsCore.onPreExecute(CrashlyticsCore.java:122)
07-25 17:30:40.918 24237 24237 E AndroidRuntime:        at com.google.firebase.crashlytics.FirebaseCrashlytics.init(FirebaseCrashlytics.java:165)
07-25 17:30:40.918 24237 24237 E AndroidRuntime:        at com.google.firebase.crashlytics.CrashlyticsRegistrar.buildCrashlytics(CrashlyticsRegistrar.java:55)
07-25 17:30:40.918 24237 24237 E AndroidRuntime:        at com.google.firebase.crashlytics.CrashlyticsRegistrar.access$lambda$0(Unknown Source:0)
07-25 17:30:40.918 24237 24237 E AndroidRuntime:        at com.google.firebase.crashlytics.CrashlyticsRegistrar$$Lambda$1.create(Unknown Source:2)

如何解决此问题?此行为是否与此处报告的Firebase问题有关?https://github.com/firebase/firebase-android-sdk/issues/1523

我使用以下依赖项:

classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'

更新:完整和增量构建的渐变构建日志。

完全重建后的Gradle日志:包含对google-services.json 的解析

Executing tasks: [clean, :app:assembleMasterRelease, :lib:assembleDebug] in project C:srchmdmandroid-kiosk

> Configure project :app
Copying common files to all enterprise build variants
> Task :clean
> Task :app:clean
> Task :lib:clean
> Task :app:copyFiles NO-SOURCE
> Task :app:preBuild UP-TO-DATE
> Task :app:injectCrashlyticsMappingFileIdMasterRelease
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:preMasterReleaseBuild
> Task :app:compileMasterReleaseAidl
> Task :app:compileMasterReleaseRenderscript NO-SOURCE
> Task :app:checkMasterReleaseManifest
> Task :app:generateMasterReleaseBuildConfig
> Task :app:processMasterReleaseGoogleServices
Parsing json file: C:srchmdmandroid-kioskappgoogle-services.json
> Task :app:generateMasterReleaseSources
> Task :app:dataBindingExportBuildInfoMasterRelease
> Task :app:dataBindingExportFeaturePackageIdsMasterRelease
> Task :app:dataBindingMergeDependencyArtifactsMasterRelease
> Task :app:dataBindingMergeGenClassesMasterRelease
> Task :app:generateMasterReleaseResValues
> Task :app:generateMasterReleaseResources
> Task :app:mergeMasterReleaseResources
> Task :app:dataBindingGenBaseClassesMasterRelease
> Task :app:javaPreCompileMasterRelease
> Task :app:mainApkListPersistenceMasterRelease
> Task :app:createMasterReleaseCompatibleScreenManifests
> Task :app:processMasterReleaseManifest
> Task :app:processMasterReleaseResources
> Task :app:compileMasterReleaseJavaWithJavac
Gradle may disable incremental compilation as the following annotation processors are not incremental: databinding-compiler-3.4.1.jar (androidx.databinding:databinding-compiler:3.4.1).
Consider setting the experimental feature flag android.enableSeparateAnnotationProcessing=true in the gradle.properties file to run annotation processing in a separate task and make compilation incremental.
warning: loading is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap loading with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutactivity_main.xml Line:50
warning: downloading is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap downloading with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutactivity_main.xml Line:63
warning: downloading is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap downloading with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutactivity_main.xml Line:72
warning: showContent is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap showContent with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutactivity_main.xml Line:98
warning: error is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap error with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_server.xml Line:41
warning: !error is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap !error with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_server.xml Line:47
warning: error is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap error with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_password.xml Line:40
warning: !error is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap !error with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_password.xml Line:46
warning: loading is a boxed field but needs to be un-boxed to execute bind:boolToDisable. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap loading with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_password.xml Line:52
warning: loading is a boxed field but needs to be un-boxed to execute bind:boolToDisable. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap loading with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_password.xml Line:67
warning: error is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap error with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_device_id.xml Line:40
warning: !error is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap !error with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_device_id.xml Line:47
warning: error is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap error with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_device_id.xml Line:91
warning: downloadedLength is a boxed field but needs to be un-boxed to execute String.valueOf(downloadedLength). This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap downloadedLength with safeUnbox() to prevent the warning
warning: fileLength is a boxed field but needs to be un-boxed to execute String.valueOf(fileLength). This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap fileLength with safeUnbox() to prevent the warning
warning: error is a boxed field but needs to be un-boxed to execute !error. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap error with safeUnbox() to prevent the warning
warning: error is a boxed field but needs to be un-boxed to execute !error. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap error with safeUnbox() to prevent the warning
warning: error is a boxed field but needs to be un-boxed to execute !error. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap error with safeUnbox() to prevent the warning
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
18 warnings
> Task :app:compileMasterReleaseSources
> Task :app:mergeMasterReleaseShaders
> Task :app:lintVitalMasterRelease
> Task :app:compileMasterReleaseShaders
> Task :app:generateMasterReleaseAssets
> Task :app:mergeMasterReleaseAssets
> Task :app:validateSigningMasterRelease
> Task :app:signingConfigWriterMasterRelease
> Task :app:checkMasterReleaseDuplicateClasses
> Task :app:transformClassesWithDexBuilderForMasterRelease
> Task :app:transformClassesWithMultidexlistForMasterRelease
> Task :app:transformDexArchiveWithDexMergerForMasterRelease
> Task :app:mergeMasterReleaseJniLibFolders
> Task :app:transformNativeLibsWithMergeJniLibsForMasterRelease
> Task :app:processMasterReleaseJavaRes NO-SOURCE
> Task :app:transformResourcesWithMergeJavaResForMasterRelease
> Task :app:packageMasterRelease
> Task :app:assembleMasterRelease
> Task :lib:preBuild UP-TO-DATE
> Task :lib:preDebugBuild UP-TO-DATE
> Task :lib:checkDebugManifest
> Task :lib:generateDebugBuildConfig
> Task :lib:generateDebugResValues
> Task :lib:processDebugManifest
> Task :lib:prepareLintJar
> Task :lib:mergeDebugConsumerProguardFiles
> Task :lib:mergeDebugShaders
> Task :lib:compileDebugShaders
> Task :lib:generateDebugAssets
> Task :lib:packageDebugAssets
> Task :lib:packageDebugRenderscript NO-SOURCE
> Task :lib:prepareLintJarForPublish
> Task :lib:compileDebugAidl
> Task :lib:compileDebugRenderscript NO-SOURCE
> Task :lib:generateDebugResources
> Task :lib:packageDebugResources
> Task :lib:generateDebugRFile
> Task :lib:generateDebugSources
> Task :lib:javaPreCompileDebug
> Task :lib:compileDebugJavaWithJavac
> Task :lib:extractDebugAnnotations
> Task :lib:processDebugJavaRes NO-SOURCE
> Task :lib:transformResourcesWithMergeJavaResForDebug
> Task :lib:transformClassesAndResourcesWithSyncLibJarsForDebug
> Task :lib:mergeDebugJniLibFolders
> Task :lib:transformNativeLibsWithMergeJniLibsForDebug
> Task :lib:transformNativeLibsWithSyncJniLibsForDebug
> Task :lib:bundleDebugAar
> Task :lib:compileDebugSources
> Task :lib:assembleDebug
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 28s
59 actionable tasks: 58 executed, 1 up-to-date

增量构建后的渐变日志:未提及google-services.json

Executing tasks: [:app:assembleMasterRelease] in project C:srchmdmandroid-kiosk

> Configure project :app
Copying common files to all enterprise build variants
> Task :app:copyFiles NO-SOURCE
> Task :app:preBuild UP-TO-DATE
> Task :app:injectCrashlyticsMappingFileIdMasterRelease UP-TO-DATE
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:preMasterReleaseBuild UP-TO-DATE
> Task :app:compileMasterReleaseAidl UP-TO-DATE
> Task :app:compileMasterReleaseRenderscript NO-SOURCE
> Task :app:checkMasterReleaseManifest UP-TO-DATE
> Task :app:generateMasterReleaseBuildConfig UP-TO-DATE
> Task :app:processMasterReleaseGoogleServices UP-TO-DATE
> Task :app:generateMasterReleaseSources UP-TO-DATE
> Task :app:dataBindingExportBuildInfoMasterRelease UP-TO-DATE
> Task :app:dataBindingExportFeaturePackageIdsMasterRelease UP-TO-DATE
> Task :app:dataBindingMergeDependencyArtifactsMasterRelease UP-TO-DATE
> Task :app:dataBindingMergeGenClassesMasterRelease UP-TO-DATE
> Task :app:generateMasterReleaseResValues UP-TO-DATE
> Task :app:generateMasterReleaseResources UP-TO-DATE
> Task :app:mergeMasterReleaseResources
> Task :app:dataBindingGenBaseClassesMasterRelease UP-TO-DATE
> Task :app:javaPreCompileMasterRelease UP-TO-DATE
> Task :app:mainApkListPersistenceMasterRelease UP-TO-DATE
> Task :app:createMasterReleaseCompatibleScreenManifests UP-TO-DATE
> Task :app:processMasterReleaseManifest UP-TO-DATE
> Task :app:processMasterReleaseResources
> Task :app:compileMasterReleaseJavaWithJavac
Gradle may disable incremental compilation as the following annotation processors are not incremental: databinding-compiler-3.4.1.jar (androidx.databinding:databinding-compiler:3.4.1).
Consider setting the experimental feature flag android.enableSeparateAnnotationProcessing=true in the gradle.properties file to run annotation processing in a separate task and make compilation incremental.
warning: loading is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap loading with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutactivity_main.xml Line:50
warning: downloading is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap downloading with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutactivity_main.xml Line:63
warning: downloading is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap downloading with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutactivity_main.xml Line:72
warning: showContent is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap showContent with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutactivity_main.xml Line:98
warning: error is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap error with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_server.xml Line:41
warning: !error is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap !error with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_server.xml Line:47
warning: error is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap error with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_password.xml Line:40
warning: !error is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap !error with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_password.xml Line:46
warning: loading is a boxed field but needs to be un-boxed to execute bind:boolToDisable. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap loading with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_password.xml Line:52
warning: loading is a boxed field but needs to be un-boxed to execute bind:boolToDisable. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap loading with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_password.xml Line:67
warning: error is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap error with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_device_id.xml Line:40
warning: !error is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap !error with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_device_id.xml Line:47
warning: error is a boxed field but needs to be un-boxed to execute bind:boolToVisible. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap error with safeUnbox() to prevent the warning
file://C:srchmdmandroid-kioskappsrcmainreslayoutdialog_enter_device_id.xml Line:91
warning: downloadedLength is a boxed field but needs to be un-boxed to execute String.valueOf(downloadedLength). This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap downloadedLength with safeUnbox() to prevent the warning
warning: fileLength is a boxed field but needs to be un-boxed to execute String.valueOf(fileLength). This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap fileLength with safeUnbox() to prevent the warning
warning: error is a boxed field but needs to be un-boxed to execute !error. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap error with safeUnbox() to prevent the warning
warning: error is a boxed field but needs to be un-boxed to execute !error. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap error with safeUnbox() to prevent the warning
warning: error is a boxed field but needs to be un-boxed to execute !error. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap error with safeUnbox() to prevent the warning
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
18 warnings
> Task :app:compileMasterReleaseSources
> Task :app:mergeMasterReleaseShaders UP-TO-DATE
> Task :app:lintVitalMasterRelease
> Task :app:compileMasterReleaseShaders UP-TO-DATE
> Task :app:generateMasterReleaseAssets UP-TO-DATE
> Task :app:mergeMasterReleaseAssets UP-TO-DATE
> Task :app:validateSigningMasterRelease UP-TO-DATE
> Task :app:signingConfigWriterMasterRelease UP-TO-DATE
> Task :app:checkMasterReleaseDuplicateClasses UP-TO-DATE
> Task :app:transformClassesWithDexBuilderForMasterRelease
> Task :app:transformClassesWithMultidexlistForMasterRelease
> Task :app:transformDexArchiveWithDexMergerForMasterRelease
> Task :app:mergeMasterReleaseJniLibFolders UP-TO-DATE
> Task :app:transformNativeLibsWithMergeJniLibsForMasterRelease UP-TO-DATE
> Task :app:processMasterReleaseJavaRes NO-SOURCE
> Task :app:transformResourcesWithMergeJavaResForMasterRelease UP-TO-DATE
> Task :app:packageMasterRelease
> Task :app:assembleMasterRelease
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 12s
34 actionable tasks: 8 executed, 26 up-to-date

同样的问题,通过将Crashlytics Gradle插件版本降级到2.1.1来修复。

Crashlytics Gradle插件版本2.2.0这次对firebase crashlytics gradle的更新包括对crashlytics任务配置和依赖声明的几项更改,这提高了增量构建性能并修复了几个已知问题。

如果您想升级Crashlytics Gradle v2.2.0+,请尝试首先升级您的Gradle版本

在gradle/wrapper/gradle-wrapper.properties文件中,将您的gradle版本升级到5.6.4
distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip

我曾经用5.1.1级运行我的应用程序,升级到5.6.4版修复了我的问题

我希望它能帮助你!

相关内容

最新更新