FlutterFire Crashlytics error: A problem occurred configuring project ':app'

Viewed 313

I am studying Firebase, and I recently added Analytics to my app, successfully. I heard about Crashlytics and decided to implement it too, however, even following all the necessary steps I ended up having an error in the build.gradle file, and I don't know what it can be. he error log:

FAILURE: Build failed with an exception.

* Where:

Build file 'C: \ Users \ ... \ ... \ ... \ MyProject \ android \ build.gradle' line: 28

* What went wrong:

A problem occurred evaluating root project 'android'.

> A problem occurred configuring project ': app'.

> Failed to notify project evaluation listener.

> org.gradle.api.GradleException: Crashlytics could not determine stripped / unstripped native library directories for project ': app', variant Release. These are required for generating symbol files when NDK build tasks cannot be automatically inferred. Please specify strippedNativeLibsDir and unstrippedNativeLibsDir in the firebaseCrashlytics extension.

> KotlinJvmAndroidCompilation with name 'release' not found.

* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

The error happens in the project level build.gradle file. This is the build.gradle file:

    buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath 'com.google.gms:google-services:4.3.4'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

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

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}

subprojects {
    project.evaluationDependsOn(':app')  // The error happens here
}

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

App level build.gradle:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 28

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        applicationId "com.example.MyProject"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug

            firebaseCrashlytics {
                nativeSymbolUploadEnabled true
            }
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation platform('com.google.firebase:firebase-bom:25.12.0')
    implementation 'com.google.firebase:firebase-crashlytics'
    implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'
} 
0 Answers
Related