Модуль был составлен с несовместимой версией Kotlin на Android Studio LadybugAndroid

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Модуль был составлен с несовместимой версией Kotlin на Android Studio Ladybug

Сообщение Anonymous »

Я использую последнюю модернизацию < /p>

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

implementation 'com.squareup.retrofit2:converter-gson:2.11.0'
< /code>
Я могу создать и запустить этот проект. Он отлично работает на эмуляторе./home/maifee-vm2/.gradle/caches/modules-2/files-2.1/com.squareup.retrofit2/retrofit/2.11.0/6ca8c6caf842271f3232e075519fe04081ef7069/retrofit-2.11.0.jar!/META-INF/retrofit.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.
Вот моя build.gradle :

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

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.4.2' apply false
id 'org.jetbrains.kotlin.android' version '1.9.0' apply false
}
А вот есть build.gradle (app) :

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

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}

apply plugin: 'kotlin-kapt'

android {
namespace 'com.mua.zebra'
compileSdk 33

defaultConfig {
applicationId "com.mua.zebra"
minSdk 16
targetSdk 33
versionCode 41
versionName "3.1"

// Cannot fit requested classes in a single dex file (# methods: 65611 > 65536)
multiDexEnabled true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

resConfigs "en", "bn"
}

buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}

debug {
viewBinding.enabled = true
}
}

buildFeatures {
dataBinding true
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
//    buildToolsVersion '33.0.2'
}

dependencies {
def lifecycle_version = "2.6.1"

// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
// Annotation processor
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
// API client
implementation 'com.squareup.retrofit2:retrofit:2.11.0'
implementation 'com.squareup.retrofit2:converter-gson:2.11.0'
// multi-dex
implementation 'com.android.support:multidex:1.0.3'

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
А вот и Proguard-rules.pro (при необходимости):

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

# Keep all classes in the androidx.lifecycle package
-keep class androidx.lifecycle.** { *; }

# Keep all classes in the androidx.compose.material3 package
-keep class androidx.compose.material3.** { *; }

# Keep all classes in the androidx.core package
-keep class androidx.core.** { *; }

# Keep all classes in the androidx.appcompat package
-keep class androidx.appcompat.** { *; }

# Keep all classes in the com.google.android.material package
-keep class com.google.android.material.** { *; }

# Keep all classes in the androidx.constraintlayout package
-keep class androidx.constraintlayout.** { *; }

# Keep Retrofit classes
-keep class retrofit2.** { *; }

# Keep OkHttp classes
-keep class okhttp3.** { *; }

# Keep GSON classes
-keep class com.google.gson.** { *; }

# Keep JUnit test classes
-keep class junit.** { *; }

# Keep Espresso classes
-keep class androidx.test.espresso.** { *;  }

# Keep the enum classes in your package
-keep enum com.mua.zebra.common.AuthTypeEnum
-keep enum com.mua.zebra.common.ActionTypeEnum

# Keep the Retrofit interfaces in your package
-keep interface com.mua.zebra.service.*

# Preserve annotations
-keepattributes *Annotation*

# Keep all methods that are overridden by the ProGuard configuration
-keep public class * extends androidx.lifecycle.ViewModel {
public (androidx.lifecycle.SavedStateHandle);
}
-keep public class * extends androidx.lifecycle.AndroidViewModel {
public (androidx.lifecycle.SavedStateHandle);
}

# Preserve Parcelable implementation
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
Я прошел другие решения, но они не работали, так как у меня даже нет возможности выбрать Kotlin из настройки. /> < /p>
А теперь я застрял с модулем, была скомпилирована с несовместимой версией Kotlin. Бинарная версия его метаданных составляет 1.9.0, ожидаемая версия 1.7.1.

Подробнее здесь: https://stackoverflow.com/questions/795 ... studio-lad
Ответить

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

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

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

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

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