kotlin 单元是使用不兼容的 kotlin 版本编译的

发布于 2025-01-12 08:10:43 字数 10790 浏览 2 评论 0原文

请我需要有关如何解决此错误的帮助,我已经搜索了堆栈溢出中的所有答案,但没有一个能解决我的问题。我最近更新了我的 kotlin,当我想运行一个新的 kotlin 应用程序时,我收到了这个错误。我尝试了堆栈溢出中的所有步骤,但都不起作用。 这是错误消息

failed
:app:compileDebugKotlin
Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    C:/Users/HP/newfolder/caches/transforms-3/a8b763bee6c7278a49a4c205da65b911/transformed/jetified-kotlin-stdlib-jdk8-1.5.30.jar (version 1.5)
    C:/Users/HP/newfolder/caches/transforms-3/e478bf55927823f4da54fcc6c8971874/transformed/jetified-kotlin-stdlib-jdk7-1.5.30.jar (version 1.5)
    C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar (version 1.6)
    C:/Users/HP/newfolder/caches/transforms-3/a891d209549d183ec22b0fd6f8a659f5/transformed/jetified-kotlin-stdlib-common-1.6.0.jar (version 1.6)
C:/Users/HP/newfolder/caches/transforms-3/18ec897b17c934613389ac8a536f0724/transformed/navigation-common-2.4.1-api.jar!/META-INF/navigation-common_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
C:/Users/HP/newfolder/caches/transforms-3/345269ef286a72cb64a64bd63517dfe5/transformed/navigation-fragment-2.4.1-api.jar!/META-INF/navigation-fragment_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
C:/Users/HP/newfolder/caches/transforms-3/5b512e38ccc4fbafd5962c1a47398a65/transformed/navigation-ui-2.4.1-api.jar!/META-INF/navigation-ui_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.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.6.0, expected version is 1.4.2.
C:/Users/HP/newfolder/caches/transforms-3/9bfb36f4d787787665db8c5d2d65e8be/transformed/navigation-runtime-2.4.1-api.jar!/META-INF/navigation-runtime_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
C:/Users/HP/newfolder/caches/transforms-3/a891d209549d183ec22b0fd6f8a659f5/transformed/jetified-kotlin-stdlib-common-1.6.0.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
C:/Users/HP/newfolder/caches/transforms-3/ae232c4ce48fac963ba307d71d188737/transformed/slidingpanelayout-1.2.0-api.jar!/META-INF/slidingpanelayout_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
app/src/main/java/com/elijah/ukeme/messengerapp/MainActivity.kt
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
app/src/main/java/com/elijah/ukeme/messengerapp/fragments/ChatFragment.kt
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
app/src/main/java/com/elijah/ukeme/messengerapp/fragments/SearchFragment.kt
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
app/src/main/java/com/elijah/ukeme/messengerapp/fragments/SettingsFragment.kt
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class

Here is my buil.gradle file

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'com.google.gms.google-services'
}

android {
    compileSdkVersion 31
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "com.elijah.ukeme.messengerapp"
        minSdkVersion 19
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

    //noinspection GradleDependency
    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.4.1'
    implementation 'androidx.navigation:navigation-ui-ktx:2.4.1'
    implementation 'com.google.firebase:firebase-auth:21.0.1'
    implementation 'com.google.firebase:firebase-database:20.0.3'
    implementation 'com.google.firebase:firebase-firestore:24.0.1'
    implementation 'com.google.firebase:firebase-storage:20.0.0'
    implementation 'com.google.firebase:firebase-messaging:23.0.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

And this is the build.gradle for app

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.4.32"
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.3"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.10'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

This is the gradle-wrapper.properties

#Sat Mar 05 12:09:03 PST 2022
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip

Please i need help on how to resolve this error, I have searched all the answers in stack overflow but non of it solve the problem for me. I updated my kotlin when recently and when i wanted to run a new kotlin application, i got this error. I tried all the steps in stack overflow but non of it work.
Here is the error message

failed
:app:compileDebugKotlin
Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    C:/Users/HP/newfolder/caches/transforms-3/a8b763bee6c7278a49a4c205da65b911/transformed/jetified-kotlin-stdlib-jdk8-1.5.30.jar (version 1.5)
    C:/Users/HP/newfolder/caches/transforms-3/e478bf55927823f4da54fcc6c8971874/transformed/jetified-kotlin-stdlib-jdk7-1.5.30.jar (version 1.5)
    C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar (version 1.6)
    C:/Users/HP/newfolder/caches/transforms-3/a891d209549d183ec22b0fd6f8a659f5/transformed/jetified-kotlin-stdlib-common-1.6.0.jar (version 1.6)
C:/Users/HP/newfolder/caches/transforms-3/18ec897b17c934613389ac8a536f0724/transformed/navigation-common-2.4.1-api.jar!/META-INF/navigation-common_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
C:/Users/HP/newfolder/caches/transforms-3/345269ef286a72cb64a64bd63517dfe5/transformed/navigation-fragment-2.4.1-api.jar!/META-INF/navigation-fragment_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
C:/Users/HP/newfolder/caches/transforms-3/5b512e38ccc4fbafd5962c1a47398a65/transformed/navigation-ui-2.4.1-api.jar!/META-INF/navigation-ui_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.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.6.0, expected version is 1.4.2.
C:/Users/HP/newfolder/caches/transforms-3/9bfb36f4d787787665db8c5d2d65e8be/transformed/navigation-runtime-2.4.1-api.jar!/META-INF/navigation-runtime_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
C:/Users/HP/newfolder/caches/transforms-3/a891d209549d183ec22b0fd6f8a659f5/transformed/jetified-kotlin-stdlib-common-1.6.0.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
C:/Users/HP/newfolder/caches/transforms-3/ae232c4ce48fac963ba307d71d188737/transformed/slidingpanelayout-1.2.0-api.jar!/META-INF/slidingpanelayout_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
app/src/main/java/com/elijah/ukeme/messengerapp/MainActivity.kt
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
app/src/main/java/com/elijah/ukeme/messengerapp/fragments/ChatFragment.kt
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
app/src/main/java/com/elijah/ukeme/messengerapp/fragments/SearchFragment.kt
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class
app/src/main/java/com/elijah/ukeme/messengerapp/fragments/SettingsFragment.kt
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.2.
The class is loaded from C:/Users/HP/newfolder/caches/transforms-3/84c66d4f4ecf6f746e3716128956475c/transformed/jetified-kotlin-stdlib-1.6.0.jar!/kotlin/Unit.class

Here is my buil.gradle file

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'com.google.gms.google-services'
}

android {
    compileSdkVersion 31
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "com.elijah.ukeme.messengerapp"
        minSdkVersion 19
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

    //noinspection GradleDependency
    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.4.1'
    implementation 'androidx.navigation:navigation-ui-ktx:2.4.1'
    implementation 'com.google.firebase:firebase-auth:21.0.1'
    implementation 'com.google.firebase:firebase-database:20.0.3'
    implementation 'com.google.firebase:firebase-firestore:24.0.1'
    implementation 'com.google.firebase:firebase-storage:20.0.0'
    implementation 'com.google.firebase:firebase-messaging:23.0.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

And this is the build.gradle for app

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.4.32"
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.3"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.10'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

This is the gradle-wrapper.properties

#Sat Mar 05 12:09:03 PST 2022
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

俯瞰星空 2025-01-19 08:10:43

将 kotlin-gradle 版本更改为:
类路径“org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31”

如果遇到错误:资源 android:attr/lStar 未找到”
然后将您的 Android 应用程序的版本更改为:
buildToolsVersion = "31.0.0"compileSdkVersion = 31 targetSdkVersion = 31

如果您遇到问题,在与操作系统无关的路径“lib/armeabi-v7a/libfbjni.so”中找到多个文件
然后将其添加到 android{...} 内的 app/build.gradle
packagingOptions { pickFirst '**/*.so' }

change the kotlin-gradle version to :
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"

If you face error: resource android:attr/lStar not found"
then change version of your android app to:
buildToolsVersion = "31.0.0" compileSdkVersion = 31 targetSdkVersion = 31

if you face issue More than one file was found with OS independent path 'lib/armeabi-v7a/libfbjni.so'
then add this inside app/build.gradle inside of android{...}
packagingOptions { pickFirst '**/*.so' }

放手` 2025-01-19 08:10:43

将您的 kotlinx.core 版本降级到 1.6.0 ,因为 1.7.0 需要 java 11

implementation 'androidx.core:core-ktx:1.6.0'

并且您的一些依赖项可能也需要 java 11 ,就像这个一样,

实现 'com.google.android.material:material:1.5.0' 降至 1.4.0

我建议你降级一些依赖版本,或者将你的android studio更新到最新版本

down grade your kotlinx.core version to 1.6.0 , because 1.7.0 required java 11

implementation 'androidx.core:core-ktx:1.6.0'

and probably some of your dependencies also required java 11, like this one,

implementation 'com.google.android.material:material:1.5.0' down to 1.4.0

i advice you to downgrade some of your dependencies version, or update your android studio to the latest version

戴着白色围巾的女孩 2025-01-19 08:10:43

在文件 android/buid.gradlew

在顶部:

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

在所有项目中:

allprojects {
  configurations.all {
    resolutionStrategy {
        force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
    }
}

}

in file android/buid.gradlew

on top :

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

in allprojects :

allprojects {
  configurations.all {
    resolutionStrategy {
        force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
    }
}

}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文