Crashlytics-在未连接到android studio的应用程序崩溃时无法获取崩溃报告 [英] Crashlytics - Unable to get crash reports when the app crashes while not connected to android studio

查看:194
本文介绍了Crashlytics-在未连接到android studio的应用程序崩溃时无法获取崩溃报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用了Fabric.io中的crashytics。

I'm using crashytics from Fabric.io in my app.

这是我在 MainActivity.java中对其进行初始化的方式 onCreate()方法的最后:

Here's how I have initialised it in my MainActivity.java at the very last of onCreate() method:

Fabric.with(this, new Crashlytics());

这是 build.gradle(项目: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(模块:应用)文件:

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'

<元数据
android:name = io.fabric .ApiKey
android:value = xxxxxxxxxxxxxxxxxxxxxxxxxxx
/>
AndroidManifest.xml 中定义, code>< application> 标签。

<meta-data android:name="io.fabric.ApiKey" android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxx" /> is defined in the AndroidManifest.xml between <application> tags.

问题是,我无法获取当应用程序在未连接Android Studio时崩溃时,崩溃报告,但我在应用程序在连接至Android Studio时崩溃时得到报告。

The problem is that I'm unable to get the crash reports whenever the app crashes while not connected to Android Studio though I get the reports when the app crashes while connected to it.

为什么会这样,无论应用程序是否崩溃,无论是否连接到Android Studio,我如何获取崩溃报告?

Why is this happening and how can I get the crash reports each and every time the app crashes whether connected to Android Studio or not?

推荐答案

活动中删除​​并放入应用

public class MyApplication extends Application {

@Override
public void onCreate() {
    super.onCreate();
    Fabric.with(this, new Crashlytics());

}

别忘了在应用程序中添加名称标签,该标签是 manifest.xml

Don't forget to add name in Application tag of manifest.xml

<application
    ...
    android:name=".MyApplication"
    ...
</application>

这篇关于Crashlytics-在未连接到android studio的应用程序崩溃时无法获取崩溃报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆