【发布时间】:2017-02-21 18:31:09
【问题描述】:
我在我的应用中使用 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 时崩溃时我会收到报告。
为什么会发生这种情况以及我如何在应用每次崩溃时获取崩溃报告,无论是否连接到 Android Studio?
【问题讨论】:
-
在应用程序崩溃后是否重新启动应用程序,其次是否启用即时运行。如果是,请尝试使用即时运行功能再次卸载和安装。
-
@AnuragSingh 即时运行功能有何影响?
-
可能是因为您第一次使用 fabric 构建您已连接到 android studio。但是当您断开与它的连接时,您的构建可能没有最新的更改。
标签: android android-studio crashlytics twitter-fabric crashlytics-android