尝试从Fabric迁移到Firebase后,Firebase Crashlytics无法正常工作。由于没有访问管理员帐户的权限,因此我不得不尝试手动配置它。无论如何,使Firebase都无法正常工作,这里是所有值得的设置,无论如何,Firebase Crashlytics都看不到该项目。 这就是我所拥有的
build.gradle(root)
buildscript {
repositories {
maven { url "https://maven.google.com/" }
jcenter()
maven { url "https://jitpack.io" }
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "io.realm:realm-gradle-plugin:5.4.1"
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-rc2'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'io.fabric.tools:gradle:1.31.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
build.gradle(app)
apply plugin: 'realm-android'
apply plugin: 'io.fabric'
android {
debug {
versionNameSuffix '-debug'
minifyEnabled false
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])'
implementation "com.google.firebase:firebase-core:17.2.1"
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.google.firebase:firebase-database:19.0.0'
implementation 'com.google.firebase:firebase-storage:19.0.0'
// google map
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
}
apply plugin: 'com.google.gms.google-services'
firebase crashlytics控制台:
{"settings_version":2,"cache_duration":86400,"features":{"collect_logged_exceptions":true,"collect_reports":true,"collect_analytics":true,"push_enabled":true},"analytics":{"url":"https:\/\/e.crashlytics.com\/spi\/v2\/events","flush_interval_secs":120,"max_file_count_per_send":1,"track_custom_events":true,"track_predefined_events":true,"flush_on_background":true,"max_byte_size_per_file":40000,"max_pending_send_file_count":20,"sampling_rate":1},"beta":{"update_suspend_duration":1209600},"app":{"identifier":"com.leaditteam.sales_representatives","status":"activated","url":"https:\/\/api.crashlytics.com\/spi\/v1\/platforms\/android\/apps\/com.leaditteam.sales_representatives","reports_url":"https:\/\/reports.crashlytics.com\/spi\/v1\/platforms\/android\/apps\/com.leaditteam.sales_representatives\/reports","ndk_reports_url":"https:\/\/reports.crashlytics.com\/sdk-api\/v1\/platforms\/android\/apps\/com.leaditteam.sales_representatives\/minidumps"},"session":{"log_buffer_size":64000,"max_chained_exception_depth":16,"max_complete_sessions_count":4,"max_custom_exception_events":8,"max_custom_key_value_pairs":64,"identifier_mask":255},"prompt":{"title":"Send Crash Report?","message":"Looks like we crashed! Please help us fix the problem by sending a crash report.","send_button_title":"Send","show_cancel_button":true,"cancel_button_title":"Don't Send","show_always_send_button":true,"always_send_button_title":"Always Send"},"expires_at":1577229779807}
应用类:
@Override
public void onCreate() {
super.onCreate();
FirebaseInstanceId.getInstance().getInstanceId()
.addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
@Override
public void onComplete(@NonNull Task<InstanceIdResult> task) {
if (!task.isSuccessful()) {
Log.w(this.getClass().getName(), "getInstanceId failed", task.getException());
return;
}
// Get new Instance ID token
String token = task.getResult().getToken();
Log.d(this.getClass().getName(), "Got the token: " + token);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.d(this.getClass().getName(), "Err tocken: " + e.getLocalizedMessage());
}
});
Fabric fabric = new Fabric.Builder(this)
.kits(new Crashlytics())
.debuggable(BuildConfig.DEBUG) // Enables Crashlytics debugger
.build();
Fabric.with(fabric);
}