admin管理员组文章数量:1277316
I am trying with help of chatGPT to compile my flutter/android build in Visual Studio Code. It worked before and now it does not.
This is my app/build.gradle
plugins {
id "com.android.application"
id "kotlin-android"
id "com.google.gms.google-services"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}
dependencies {
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:33.9.0')
// Add required Firebase dependencies here
implementation 'com.google.firebase:firebase-messaging'
}
android {
compileSdk 35 //rootProject.extpileSdkVersion
namespace = "com.example.kommunappen"
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
}
defaultConfig {
applicationId "com.example.kommunappen"
minSdk 28//rootProject.ext.minSdkVersion
targetSdk 35 //rootProject.ext.targetSdkVersion
versionCode flutter.versionCode
versionName flutter.versionName
}
println("compileSdkVersion: " + androidpileSdkVersion)
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
}
flutter {
source = "../.."
}
This is my android/build.gradle
plugins {
id 'com.android.application'
id "kotlin-android"
id 'com.google.gms.google-services' version '4.4.2' apply true
}
ext {
kotlin_version = '1.8.20'
compileSdkVersion = 35
targetSdk = 35
minSdk = 28
appCompatVersion = "1.6.1"
playServicesLocationVersion = "21.3.0"
hmsLocationVersion = "6.12.0.300"
removeBackgroundGeolocationDebugSoundsInRelease = false
}
allprojects {
repositories {
google()
mavenCentral()
maven { url "${project(':flutter_background_geolocation').projectDir}/libs" }
maven { url '/' }
maven { url "${project(':background_fetch').projectDir}/libs" }
jcenter()
}
}
println("DEBUG: compileSdkVersion from ext is: " + extpileSdkVersion)
rootProject.buildDir = "../build"
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(":app")
}
My println gives DEBUG: compileSdkVersion from ext is: 35 compileSdkVersion: android-35
Still I get the error: A problem occurred configuring root project 'android'.
com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
I tried to build my Android project and expected it to work. Instead it throws this error and I cannot figure out what is wrong.
I am trying with help of chatGPT to compile my flutter/android build in Visual Studio Code. It worked before and now it does not.
This is my app/build.gradle
plugins {
id "com.android.application"
id "kotlin-android"
id "com.google.gms.google-services"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}
dependencies {
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:33.9.0')
// Add required Firebase dependencies here
implementation 'com.google.firebase:firebase-messaging'
}
android {
compileSdk 35 //rootProject.extpileSdkVersion
namespace = "com.example.kommunappen"
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
}
defaultConfig {
applicationId "com.example.kommunappen"
minSdk 28//rootProject.ext.minSdkVersion
targetSdk 35 //rootProject.ext.targetSdkVersion
versionCode flutter.versionCode
versionName flutter.versionName
}
println("compileSdkVersion: " + androidpileSdkVersion)
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
}
flutter {
source = "../.."
}
This is my android/build.gradle
plugins {
id 'com.android.application'
id "kotlin-android"
id 'com.google.gms.google-services' version '4.4.2' apply true
}
ext {
kotlin_version = '1.8.20'
compileSdkVersion = 35
targetSdk = 35
minSdk = 28
appCompatVersion = "1.6.1"
playServicesLocationVersion = "21.3.0"
hmsLocationVersion = "6.12.0.300"
removeBackgroundGeolocationDebugSoundsInRelease = false
}
allprojects {
repositories {
google()
mavenCentral()
maven { url "${project(':flutter_background_geolocation').projectDir}/libs" }
maven { url 'https://developer.huawei/repo/' }
maven { url "${project(':background_fetch').projectDir}/libs" }
jcenter()
}
}
println("DEBUG: compileSdkVersion from ext is: " + extpileSdkVersion)
rootProject.buildDir = "../build"
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(":app")
}
My println gives DEBUG: compileSdkVersion from ext is: 35 compileSdkVersion: android-35
Still I get the error: A problem occurred configuring root project 'android'.
com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
I tried to build my Android project and expected it to work. Instead it throws this error and I cannot figure out what is wrong.
Share Improve this question asked Feb 25 at 10:58 Martin HolménMartin Holmén 92 bronze badges 4- May I know why you commented //rootProject.extpileSdkVersion and directly added 35? – Vijay Commented Feb 26 at 2:23
- As part of trying to find the error. Both give the same result though. – Martin Holmén Commented Feb 26 at 14:10
- Add an = between the compileSdk and 35 – Nnamani Daniel Commented Feb 28 at 11:54
- Same error with the added = – Martin Holmén Commented Feb 28 at 12:48
2 Answers
Reset to default 0Your compileSdkVersion = 35
means nothing and is not what it is asking for. You need to replace compileSdk
in your apps build.gradle with compileSdkVersion
In the Android/build.gradle, remove everything before allprojects{
本文标签:
版权声明:本文标题:flutter - A problem occurred configuring root project 'android'. > : compileSdkVersion is not specified. 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741208620a2358654.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论