Проблема в версии gradle в build.gradleAndroid

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Проблема в версии gradle в build.gradle

Сообщение Anonymous »

Я делаю проект IN FLUTTER, приложение для отображения изменяющейся широты и долготы в реальном времени из базы данных Firebase в карту Google.
ошибка в версии Gradle
вот файл build.gradle
buildscript {
ext.kotlin_version = '2.0.0' // Use the latest stable version of Kotlin
repositories {
google()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:8.5.0' // Ensure this version is compatible with your project
classpath 'com.google.gms:google-services:4.4.2' // Ensure this version is compatible with your project
}
}

plugins {
id "com.android.application"
id "kotlin-android"
id 'com.google.gms.google-services' // Firebase Configuration
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.1.0.0')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

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

android {
compileSdkVersion 34

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

defaultConfig {
applicationId "com.aaddev.my_loc"
minSdkVersion flutter.minSdkVersion // Ensure flutter.minSdkVersion is defined, otherwise use a specific value like 20
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}

buildTypes {
release {
signingConfig signingConfigs.debug
}
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:33.1.1')
implementation 'com.google.firebase:firebase-analytics-ktx'
}

flutter {
source '../..'
}


Я обновил версию Kotlin до 2.0.0, но возникла ошибка
e: C:/Users/user/.gradle/caches/transforms-3/7b98c11195bdca8224a49fc5d6002767/transformed/jetified-kotlin-stdlib-2.0.0.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
e: C:/Users/user/.gradle/caches/transforms-3/7b98c11195bdca8224a49fc5d6002767/transformed/jetified-kotlin-stdlib-2.0.0.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
e: C:/Users/user/.gradle/caches/transforms-3/7b98c11195bdca8224a49fc5d6002767/transformed/jetified-kotlin-stdlib-2.0.0.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
e: C:/Users/user/.gradle/caches/transforms-3/810712b9a5e6b19d9828bd87b672432b/transformed/jetified-firebase-analytics-ktx-22.0.1-api.jar!/META-INF/java.com.google.android.libraries.firebase.firebase_analytics_ktx_granule.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
e: C:/Users/user/.gradle/caches/transforms-3/bb9f6311be59e44fb99f3c2ff4470e95/transformed/jetified-play-services-measurement-api-22.0.1-api.jar!/META-INF/java.com.google.android.gmscore.integ.client.measurement_api_measurement_api.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details

* Try:
> 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 7m 47s
Running Gradle task 'assembleDebug'... 468.6s

┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin. │
│ Find the latest version on https://kotlinlang.org/docs/releases.ht ... se-details, then update │
│ E:\realtime2\android\build.gradle: │
│ ext.kotlin_version = '' │
└───────────────────────────────────────────────────────────────────────────────────────────────────┘
Gradle task assembleDebug failed with exit code 1 i updated kotilin to latest version that is 2.0.0 but then also same error is rising


Подробнее здесь: https://stackoverflow.com/questions/786 ... ild-gradle
Ответить

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

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

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

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

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