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]
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.org.
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 = flutter.compileSdkVersion
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 = "../.."
}
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