发生了一个问题,即配置根项目“ Android”。 >:未指定compilesdkversion。请添加到build.gradle

问题描述 投票:0回答:1

我正在借助chatgpt尝试编译我的flutter/android在Visual Studio代码中构建。它以前起作用了,现在没有。

这是我的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.ext.compileSdkVersion
    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: " + android.compileSdkVersion)

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

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

这是我的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.com/repo/' }
        maven { url "${project(':background_fetch').projectDir}/libs" }
        jcenter()
    }
}

println("DEBUG: compileSdkVersion from ext is: " + ext.compileSdkVersion)

rootProject.buildDir = "../build"
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(":app")
}
我的println给出了 调试:来自Ext的CompilesDkversion是:35 compilesdkversion:Android-35

因为我得到错误: 出现问题的问题是配置root项目'android'。

COM.ANDROID.BUILDER.ERRORS.EVALISSUEEXEXPEPTION:未指定CompileSdkversion。请添加到build.gradle

我试图构建我的Android项目,并希望它能起作用。相反,它引发了此错误,我无法弄清楚什么问题。

您的意思是什么,而不是它的要求。您需要在应用程序build.gradle中替换

compileSdkVersion = 35

android flutter build build.gradle
1个回答
0
投票

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.