我的Crashlytics数据未出现在Firebase Crashlytics视图中。它确实显示“无崩溃统计”为75%,所以它似乎记录了一些数据。我还看到崩溃立即出现在Fabric和旧的Firebase崩溃报告界面中,以及DebugView中作为常规事件出现,但在Crashlytics页面的Issues部分什么都没有。我想也许我的Fabric项目没有链接到Firebase项目,但是当我尝试使用这个链接手动执行它时
https://www.fabric.io/firebase_migration/apps
它告诉我这些项目已经联系在一起了,特别是它说
Project already contains a linked app with that bundle ID and platform
. 每次在androidstudio中打开应用程序时,我都会立即运行命令
adb shell setprop debug.firebase.analytics.app ie.moses.keepitlocal
这是我的项目构建.gradle文件:
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:3.3.0'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
def supportLibraryVersion = '27.1.1'
android {
compileSdkVersion 27
defaultConfig {
applicationId "ie.moses.keepitlocal"
minSdkVersion 16
targetSdkVersion 27
versionCode 5
versionName "0.3.1-alpha"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
buildConfigField 'boolean', 'CRASHLYTICS', 'true'
}
release {
buildConfigField 'boolean', 'CRASHLYTICS', 'true'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.android.support') {
// Used to prevent conflicting versions of Android support library
// contained in other dependencies (e.g. all the firebase dependencies)
details.useVersion supportLibraryVersion
}
}
}
dependencies {
implementation files('libs/YouTubeAndroidPlayerApi.jar')
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
implementation "com.android.support:cardview-v7:$supportLibraryVersion"
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-crash:16.2.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
implementation 'com.google.guava:guava:26.0-android'
}
apply plugin: 'com.google.gms.google-services'
我使用一个按钮来强制执行以下代码的崩溃(正如我提到的,这些崩溃几乎立即出现在Fabric和旧的崩溃报告界面中,该界面已被弃用,将在2天内删除!)。下面是崩溃按钮的代码:
Button crashButton = new Button(this);
crashButton.setText("Crash!");
crashButton.setOnClickListener(view -> {
throw new IllegalStateException("you hit the crash button!");
});
addContentView(crashButton, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
编辑
每次打开androidstudio时,我还需要从Fabric插件重新安装Crashlytics库。依赖项已经存在于我的gradle文件中,但是插件似乎无法识别它们。
Unlink an existing firebase app?
,但fabric甚至没有在我的项目中作为集成列出。