2016-08-24 93 views
3

我的build.gradle文件火力地堡:無法初始化崩潰報告

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:design:22.2.1' 
    compile 'com.google.firebase:firebase-core:9.4.0' 
    compile "com.google.firebase:firebase-auth:9.4.0" 
    compile 'com.google.firebase:firebase-crash:9.4.0' 

} 

apply plugin: 'com.google.gms.google-services' 

我這是如何初始化火力崩潰:

FirebaseCrash.report(new Exception("My first Android non-fatal error")); 

,但我從logcat中得到這個:

Failed to initialize crash reporting 
    com.google.firebase.crash.internal.zzg$zza: com.google.android.gms.internal.zzsb$zza: 
No acceptable module found. Local version is 0 and remote version is 0. 
+0

您是否可以使用您正在測試的設備上安裝的Play Services版本更新此版本? –

+0

@DougStevenson我正在模擬器中測試,並且Play服務已更新。 降級到firebase 9.0.2解決了這個問題。 –

+0

您應該始終能夠使用最新的客戶端庫。您可以驗證模擬器上運行的Play服務的版本嗎?這是重要的一部分。 –

回答

3

如果您沒有在設備上更新Google Play服務或者根本沒有安裝它,崩潰報告將不會初始化。

+0

Google Play服務已在我的設備上安裝並更新,但仍然出現此錯誤 –

+0

僅當您沒有安裝或更新Google Play服務時纔會引發此錯誤,因此請在模擬器上使用Google API進行嘗試,看看它是否有效 – mayosk

+0

否,它不工作 –

0

我同意@user6749691的失敗很可能是由於Google Play服務的舊版本或不存在造成的。問題是discussed here

您可以確認已安裝的播放服務就足夠了加入這個方法,把它當你的應用程序初始化支持火力地堡:

private void showGooglePlayServicesStatus() { 
    GoogleApiAvailability apiAvail = GoogleApiAvailability.getInstance(); 
    int errorCode = apiAvail.isGooglePlayServicesAvailable(this); 
    String msg = "Play Services: " + apiAvail.getErrorString(errorCode); 
    Log.d(TAG, msg); 
    Toast.makeText(this, msg, Toast.LENGTH_LONG).show(); 
} 
0

檢查錯別字,這可能是一個原因了。

compile 'com.google.firebase:firebase-ads:11.0.2' 
compile 'com.google.firebase:firebase-core:11.0.2' 
compile 'com.google.firebase:firebase-messaging:11.0.2' 
compile 'com.google.firebase:firebase-crash:11.0.1' 

愚蠢的錯誤,很難找到,但例如,我有x.x.1,而不是x.x.2,並且所有的Firebase/Google Play服務庫都應使用相同的版本。

相關問題