Несовместимость версии Kotlin при создании apk с помощью Flutter - Android StudioAndroid

Форум для тех, кто программирует под Android
Ответить Пред. темаСлед. тема
Anonymous
 Несовместимость версии Kotlin при создании apk с помощью Flutter - Android Studio

Сообщение Anonymous »

При создании APK я получил эту ошибку:

C:/Users/Hao/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.9.10/dafaf2c2 7f27c09220cee312df10917d9a5d97ce/kotlin-stdlib-common-1.9.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Модуль был скомпилирован с несовместимой версией Kotlin. Двоичная версия метаданных — 1.9.0, ожидаемая версия — 1.6.0.

Есть и другие версии с двоичными метаданными — 1.8.0. или 1.9.9999, также ожидается 1.6.0.

Я пробовал решить с помощью ext.kotlin_version в android\build.gradle, но ничего изменено.

Также пытаюсь понизить версию: я получил сообщение о слишком старой версии Kotlin -> сборка не удалась.

Пытаюсь очистить/пересобрать проект: ничего не изменилось.

Пыталась очистить кеш в Users/user/.android, но тоже не сработало.

Также пытаюсь настроить параметры Android Studio/структуру проекта/плагины.

Пересобрать Gradle для синхронизации ./gradlew build, я получил: Не удалось определить зависимости задачи ':google_mobile_ads:test'.

Не удалось создать задачу ': google_mobile_ads:testProfileUnitTest'.
этот и базовый файлы имеют разные корни: E:\Projects\project\build\google_mobile_ads и C:\Users\Hao\AppData\Local\Pub\Cache\hosted\pub.dev\google_mobile_ads-5.2.0\android.

Что я могу сделать? исправили с момента появления ошибки:

settings.gradle:

Код: Выделить всё

pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.1" apply false //downgraded and upgraded
id "org.jetbrains.kotlin.android" version "1.9.10"  apply false //changed to 1.6.x / 1.7.x / 1.8.x
id 'com.google.gms.google-services' version '4.4.2' apply false //changed to 4.3.15 for another error
}

include ":app"

android\build.gradle:

Код: Выделить всё

buildscript {
ext.kotlin_version = '1.9.10' //comment in, out
repositories {
google()
mavenCentral()
//        maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}

dependencies {
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.google.gms:google-services:4.4.2") //changed with the one in settings.gradle
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") // comment in, out with ext.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
}

app\build.gradle:

Код: Выделить всё

plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
id "com.google.gms.google-services"
}

dependencies {
implementation platform('com.google.firebase:firebase-bom:33.5.1')

implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version")
implementation('com.google.firebase:firebase-auth:23.1.0')
implementation('com.google.firebase:firebase-firestore:25.1.1')
implementation('com.google.android.gms:play-services-base:18.5.0')
implementation("com.google.android.gms:play-services-ads:23.5.0")
implementation("com.google.firebase:firebase-ads:23.5.0")
//    implementation("androidx.core:core-ktx:1.9.0")
//    implementation('com.google.android.gms:play-services-security:18.0.0')
//    implementation('androidx.appcompat:appcompat:1.7.0')
//    implementation('androidx.legacy:legacy-support-v4:1.0.0')
//    implementation('androidx.annotation:annotation:1.9.1')
//    configurations.all {
//        resolutionStrategy {
//            force "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
//            force "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
//            force "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//            force "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
//        }
//    }
}
//apply plugins('com.google.gms.google-services')

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.tictactoe_rebuild"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

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

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.tictactoe_rebuild"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = 23/*flutter.minSdkVersion*/
targetSdk = flutter.targetSdkVersion
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
}

kotlinOptions {
jvmTarget = "17"
}

buildTypes {
release {
// TODO:  Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.debug
}
}
}

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

Мне нужно их исправить, чтобы мои объявления могли показываться.

Подробнее здесь: https://stackoverflow.com/questions/791 ... oid-studio
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Android»