ParkDyel
ParkDyel

Reputation: 312

I'm trying to apply crashlytics and an error has occurred in gradle

There is a problem that the existing app is often forced to terminate. While searching for related technologies to report error messages from these remote devices, I came across firebase crashlytics and wanted to apply it.

However, when I added the code according to the guide, the problem occurred in the gradle script.

try with the link: https://firebase.google.com/docs/crashlytics/get-started?platform=android

The newly added code is between __.

// project 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.3.0'
        classpath 'io.fabric.tools:gradle:1.31.0'__

    }
}

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

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


// app gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    signingConfigs {
        debug {
            // ...
        }
    }
    compileSdkVersion 28
    defaultConfig {
        applicationId // ...
        minSdkVersion 19
        targetSdkVersion 24
        versionCode // ...
        versionName // ...
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            signingConfig signingConfigs.debug
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    __implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.firebase:firebase-analytics:17.2.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'__

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    api 'com.journeyapps:zxing-android-embedded:3.6.0'
    api 'com.google.zxing:core:3.3.0'
    api 'com.github.felHR85:UsbSerial:3.3'
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

___apply plugin: 'com.google.gms.google-services'___

sync failed message

 -> ASCII

Run Build message

 -> org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Build file '${project}\app\build.gradle' line: 1
 -> A problem occurred evaluating project ':app'
  ...\
 -> Caused by: org.gradle.internal.exceptions.LocationAwareException: Build file '${project}\app\build.gradle' line: 1

I don't understand what the problem is because the error message doesn't make sense at all. I don't know if it's just a broken encoding or a version issue between the libraries I'm referring to.

Upvotes: 0

Views: 283

Answers (1)

Praful Korat
Praful Korat

Reputation: 438

Add below line into your manifest :

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

If still its not working than migrate your app into androidX and Convert your application class to MultiDexApplication class

App level build.gradle:

buildTypes {
    release {
        multiDexEnabled true;

    }
    debug {
        multiDexEnabled true;

    }
}

dependencies {  
    implementation 'com.android.support:multidex:1.0.3'
}

Create MultiDexApplication class:


public class MyApplication extends MultiDexApplication {

    @Override
    public void onCreate() {
        super.onCreate();

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

Set the new class in AndroidManifest.xml

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

</application>


Upvotes: 2

Related Questions