我在我的应用程序中使用 Fabric.io 的 crashytics。
这是我MainActivity.java
在最后一个方法中初始化它的onCreate()
方式:
Fabric.with(this, new Crashlytics());
这是build.gradle (Project: abc)
文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public'}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://dl.bintray.com/hani-momanii/maven"}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是build.gradle (Module: app)
文件:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.xxx.abc"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
maven { url 'https://maven.fabric.io/public' }
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
transitive = true;
}
}
apply plugin: 'com.google.gms.google-services'
和
<meta-data
android:name="io.fabric.ApiKey"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxx"
/>
在标签AndroidManifest.xml
之间定义。<application>
问题是,当应用程序在未连接到 Android Studio 时崩溃时,我无法获取崩溃报告,尽管当应用程序在连接到它时崩溃时我会收到报告。
为什么会发生这种情况?无论是否连接到 Android Studio,每次应用程序崩溃时,我如何获取崩溃报告?