简体   繁体   中英

Firebase Crashlytics vs Fabric Crashlytics

I was integrating Crashlytics following this article https://firebase.google.com/docs/crashlytics/get-started

This is my project level gradle

buildscript {

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

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'
        // Add dependency
        classpath 'io.fabric.tools:gradle:1.27.0'
    }
}

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

    }
}

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

// Define versions in a single place
ext {
    // Sdk and tools
    minSdkVersion = 16
    targetSdkVersion = 28
    compileSdkVersion = 28
    // App dependencies
    supportLibraryVersion = '27.1.1'
    sqlbriteVersion = '0.7.0'
    rxjavaVersion = '2.0.8'
    rxandroidVersion = '2.0.1'
    retrofitVersion = '2.3.0'
    daggerVersion = '2.11'
    playServicesVersion = '16.0.0'
    constraintLayoutVersion='2.0.0-alpha2'
    roomVersion = '1.0.0'
    picassoVersion = '2.5.2'
    flexboxVersion = '0.3.2'
    firebaseMessagingVersion='17.3.4'
    firebaseCoreVersion='16.0.6'
    crashlyticsVersion='2.9.8'
}

This is my app level gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.seed.app"
        minSdkVersion 17
        targetSdkVersion 26
        multiDexEnabled  true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    //dagger
    compile "com.google.dagger:dagger:$rootProject.daggerVersion"
    annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.daggerVersion"
    compile "com.google.dagger:dagger-android:$rootProject.daggerVersion"
    compile "com.google.dagger:dagger-android-support:$rootProject.daggerVersion"

    implementation 'com.android.support:multidex:1.0.3'


    //firebase
    implementation "com.google.firebase:firebase-messaging:$rootProject.firebaseMessagingVersion"
    implementation "com.google.firebase:firebase-core:$rootProject.firebaseCoreVersion"

    // Crashlytics
    implementation "com.crashlytics.sdk.android:crashlytics:$rootProject.crashlyticsVersion"

}
repositories {
    mavenCentral()
}


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

This is how I crash my application in the MainActivity.

Crashlytics.getInstance().crash();

I am unable to get any errors in my firebase console and get an error message in the log

2019-01-02 20:36:55.139 21274-21274/com.seed.app E/CrashlyticsCore: This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up,
    install an Android build tool and ask a team member to invite you to this app's organization.

What has my crashlytics installation gotta do with Fabric?

I was able to get this to work by repositioning the apply plugins in my app gradle to

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric' 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM