android - Flutter Firebase Integration Error: NDK Version Conflict - Stack Overflow

Launching libmain.dart on sdk gphone64 x86 64 in debug mode...FAILURE: Build failed with an exception

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...

FAILURE: Build failed with an exception.

  • Where: Build file 'C:\Users\KimoStore\StudioProjects\flutter_course_1\android\build.gradle.kts' line: 16

  • What went wrong: A problem occurred configuring project ':app'.

com.android.builder.errors.EvalIssueException: [CXX1104] NDK from ndk.dir at C:\Users\KimoStore\AppData\Local\Android\Sdk\ndk\27.0.12077973 had version [27.0.12077973] which disagrees with android.ndkVersion [26.3.11579264]

  • 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. Get more help at .

BUILD FAILED in 1m 8s Error: Gradle task assembleDebug failed with exit code 1

Exited (1).

I downloaded both versions of NDK (26.3.11579264 and 27.0.12077973) and tried adding version 26.3.11579264 to the system variables. I also added the other version, but the same error still occurs.

android/build.gradle.kts

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
rootProject.layout.buildDirectory.value(newBuildDir)

subprojects {
    val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
    project.layout.buildDirectory.value(newSubprojectBuildDir)
}

subprojects {
    project.evaluationDependsOn(":app")
}

tasks.register<Delete>("clean") {
    delete(rootProject.layout.buildDirectory)
}

android/app/build.gradle.kts

plugins {
    id("com.android.application")
    // FlutterFire Configuration
    id("com.google.gms.google-services")
    id("kotlin-android")
    // The Flutter Gradle Plugin must be applied after them
    id("dev.flutter.flutter-gradle-plugin")
}

android {
    namespace = "com.example.flutter_course_1"
    compileSdk = flutterpileSdkVersion
    ndkVersion = flutter.ndkVersion

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_11.toString()
    }

    defaultConfig {
        // Specify a unique Application ID
        applicationId = "com.example.flutter_course_1"
        minSdk = flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }

    buildTypes {
        release {
            // Using debug signing for now so `flutter run --release` works
            signingConfig = signingConfigs.getByName("debug")
        }
    }
}

flutter {
    source = "../.."
}

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...

FAILURE: Build failed with an exception.

  • Where: Build file 'C:\Users\KimoStore\StudioProjects\flutter_course_1\android\build.gradle.kts' line: 16

  • What went wrong: A problem occurred configuring project ':app'.

com.android.builder.errors.EvalIssueException: [CXX1104] NDK from ndk.dir at C:\Users\KimoStore\AppData\Local\Android\Sdk\ndk\27.0.12077973 had version [27.0.12077973] which disagrees with android.ndkVersion [26.3.11579264]

  • 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. Get more help at https://help.gradle..

BUILD FAILED in 1m 8s Error: Gradle task assembleDebug failed with exit code 1

Exited (1).

I downloaded both versions of NDK (26.3.11579264 and 27.0.12077973) and tried adding version 26.3.11579264 to the system variables. I also added the other version, but the same error still occurs.

android/build.gradle.kts

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
rootProject.layout.buildDirectory.value(newBuildDir)

subprojects {
    val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
    project.layout.buildDirectory.value(newSubprojectBuildDir)
}

subprojects {
    project.evaluationDependsOn(":app")
}

tasks.register<Delete>("clean") {
    delete(rootProject.layout.buildDirectory)
}

android/app/build.gradle.kts

plugins {
    id("com.android.application")
    // FlutterFire Configuration
    id("com.google.gms.google-services")
    id("kotlin-android")
    // The Flutter Gradle Plugin must be applied after them
    id("dev.flutter.flutter-gradle-plugin")
}

android {
    namespace = "com.example.flutter_course_1"
    compileSdk = flutterpileSdkVersion
    ndkVersion = flutter.ndkVersion

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_11.toString()
    }

    defaultConfig {
        // Specify a unique Application ID
        applicationId = "com.example.flutter_course_1"
        minSdk = flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }

    buildTypes {
        release {
            // Using debug signing for now so `flutter run --release` works
            signingConfig = signingConfigs.getByName("debug")
        }
    }
}

flutter {
    source = "../.."
}
Share Improve this question asked Mar 23 at 18:26 Kerollos MeladKerollos Melad 33 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

I had the same issue.

I've added the following config in /your-project-dir/android/app/build.gradle.kts

android {
    // ...
    defaultConfig {
        ndkVersion = "27.0.12077973"
        minSdk = 23
        // ...
    }
    // ...
}

Your app will not work on android version <= 6.0

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744274328a4566255.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信