Firebase Crashlytics не показывает мои ошибки - PullRequest
0 голосов
/ 29 августа 2018

Я пытался заставить Crashlytics работать, но, несмотря на то, что я выполнил все шаги, я все еще не вижу никаких ошибок, видимых в Crashlytics.

Не могли бы вы взглянуть?

Это код, который я использую для запуска сбоя:

Crashlytics.getInstance().crash(); // Force a crash

Мой App Gradle:

apply plugin: 'com.android.application'

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            lintOptions {
                disable 'MissingTranslation'
            }
        }
    }
    buildToolsVersion '27.0.3'
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
        maven { url 'https://maven.fabric.io/public' }
    }
}

repositories {
    mavenCentral()
}
apply plugin: 'io.fabric'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:25.+'
    implementation 'com.android.support:design:25.+'
    implementation 'com.android.support:support-v4:25.+'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.roughike:bottom-bar:2.3.1'
    testImplementation 'junit:junit:4.12'

    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.firebaseui:firebase-ui-auth:4.1.0'

    // Required only if Facebook login support is r6equired
    implementation 'com.facebook.android:facebook-android-sdk:4.27.0'

    // Required only if Twitter login support is required
    implementation("com.twitter.sdk.android:twitter-core:3.0.0@aar") { transitive = true }

    implementation 'com.google.firebase:firebase-storage:16.0.1'

    implementation 'com.google.firebase:firebase-messaging:17.3.0'

    //compile 'com.google.firebase:firebase-crash:16.0.0'

    // Displaying images
    implementation 'com.github.bumptech.glide:glide:3.7.0'

    //implementation 'com.google.android.gms:play-services:15.0.0'

    implementation 'com.google.android.gms:play-services-auth:16.0.0'
    implementation 'com.google.android.gms:play-services-base:15.0.1'
    implementation 'com.google.android.gms:play-services-identity:15.0.1'
    implementation 'com.google.android.gms:play-services-analytics:16.0.3'
    implementation 'com.google.android.gms:play-services-gcm:15.0.1'
    implementation 'com.google.android.gms:play-services-vision:15.0.2'

    implementation 'com.github.amlcurran.showcaseview:library:5.4.3'

    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'

    implementation files('libs/YouTubeAndroidPlayerApi.jar')
}

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.1'
            }
        }
    }
}

apply plugin: 'com.google.gms.google-services'

My Build Gradle (я также взял новый файл google-services.json из настроек Firebase):

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:4.0.1'
        classpath 'io.fabric.tools:gradle:1.25.4'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

А это мой манифест

<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="blah">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CLEAR_APP_CACHE" />

    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/SplashScreenTheme">
        // metadata for Facebook login
        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id"
            tools:replace="android:value" />
        <activity
            android:name=".SplashScreen"
            android:screenOrientation="portrait">
            -
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".MainActivity"
            android:configChanges="orientation|screenSize"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.TransNav" />
        <activity
            android:name=".QRCodeScannerActivity"
            android:theme="@style/Theme.TransNav" />
        //Facebook activities for Facebook login
        <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name" />
        <activity
        android:name="com.facebook.CustomTabActivity"
        android:exported="true">

        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:scheme="@string/fb_login_protocol_scheme" />
        </intent-filter>
    </activity>

        <meta-data
            android:name="com.google.android.gms.vision.DEPENDENCIES"
            android:value="barcode" />
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_logo_without_text" />
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/white" />
        <meta-data
            android:name="io.fabric.ApiKey"
            android:value="blh"/>

        <service android:name=".MyFirebaseInstanceIDService">

            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
            </intent-filter>
        </service>

        <service android:name=".MyFirebaseMessaging">
            -
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
    </application>
</manifest>

Ответы [ 2 ]

0 голосов
/ 31 августа 2018

Попробуйте включить режим отладки, как в документации здесь .

1) Добавьте эти строки в Манифест

<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />

2) При инициализации Crashlytics включите режим отладки.

final Fabric fabric = new Fabric.Builder(this)
    .kits(new Crashlytics())
    .debuggable(true)  // Enables Crashlytics debugger
    .build();
Fabric.with(fabric);    
0 голосов
/ 29 августа 2018

Время от времени Firebase Crashlytics, требуется время, чтобы зарегистрировать Crash. Подождите некоторое время, и если вы выполнили правильные шаги, я уверен, что сбой появится через некоторое время.

EDIT

Выполните следующие действия:

  1. Добавление репозиториев Crashlytics и зависимостей в файл build.gradle уровня проекта .

    maven {
       url 'https://maven.fabric.io/public'
    }
    
    dependencies {
    // ...
    classpath 'io.fabric.tools:gradle:1.25.4'
    }
    
    allprojects {
        repositories {
    
      maven {
       url 'https://maven.google.com/'
          }
        }
    }
    

Также, проверьте Crashlytics требуется плагин Служб Google версии 3.1.2 или выше. Проверьте номер версии com.google.gms: google-services в зависимостях build.gradle вашего проекта.

2.) Добавьте зависимости Crashlytics в ваш уровень приложения build.gradle :

    apply plugin: 'io.fabric'
    dependencies {
    // ...
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
    }

Оставьте это в качестве кнопки Force Crash:

    Button crashButton = new Button(this);
    crashButton.setText("Crash!");
    crashButton.setOnClickListener(new View.OnClickListener() {
    public void onClick(View view) {
    Crashlytics.getInstance().crash(); // Force a crash
}
});

   addContentView(crashButton, new ViewGroup.LayoutParams(
    ViewGroup.LayoutParams.MATCH_PARENT,
    ViewGroup.LayoutParams.WRAP_CONTENT));
...