gradle 不兼容的版本,试图建立我的apk

2nbm6dog  于 5个月前  发布在  其他
关注(0)|答案(1)|浏览(67)

IM tyring使APK从我的应用程序,但它遇到了这个问题:

Your project requires a newer version of the Kotlin Gradle plugin.Find the latest version on                     https://kotlinlang.org/docs/releases.html#release-details, then update C:\Users\xxx\android\build.gradle: ext.kotlin_version = '<latest-version>'

字符串
但是当我在1.9.0中更新它时,就像这样:
Build.gradle:

buildscript {
    ext.kotlin_version = '1.9.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

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

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}


它是这样说的:

module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.


我不明白我必须更新或不Kotlin版本?还有我的应用程序构建grandle是这样的:应用程序/构建.Gradle

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

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

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

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

android {
    namespace "com.example.app"
    compileSdkVersion flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

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

    defaultConfig {
        applicationId "com.example.app"
        gradle-build-configuration.
        minSdkVersion 28//flutter.minSdkVersion
        targetSdkVersion 31//28//flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {}


发生了什么事,我想尝试3个小时了...

hi3rlvi2

hi3rlvi21#

使用Kotlin版本是
ext.Kotlin_版本= '1.6.10'

相关问题