美文网首页
Flutter Android 打包报错:Module was

Flutter Android 打包报错:Module was

作者: JamieChen | 来源:发表于2021-06-07 11:11 被阅读0次

出现问题:

e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
e: /Users/user/.gradle/caches/transforms-2/files-2.1/2ea2c8b52f906f98d5deda90cfed9dad/jetified-kotlin-stdlib-common-1.5.10.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.5.1, expected version is 1.1.15.
e: /Users/user/.gradle/caches/transforms-2/files-2.1/3b0753969d68ffd5874e4b39343d65d1/jetified-kotlin-stdlib-1.5.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: /Users/user/.gradle/caches/transforms-2/files-2.1/d03ac8f4b530d2e19911a538ea8e8ac4/jetified-core-ktx-1.6.0-beta02-api.jar!/META-INF/core-ktx_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
e: /Users/user/.pub-cache/hosted/pub.flutter-io.cn/audioplayers-0.18.3/android/src/main/kotlin/xyz/luan/audioplayers/AudioplayersPlugin.kt: (18, 32): Unresolved reference: mutableMapOf
e: /Users/user/.pub-cache/hosted/pub.flutter-io.cn/audioplayers-0.18.3/android/src/main/kotlin/xyz/luan/audioplayers/AudioplayersPlugin.kt: (25, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from /Users/user/.gradle/caches/transforms-2/files-2.1/3b0753969d68ffd5874e4b39343d65d1/jetified-kotlin-stdlib-1.5.10.jar!/kotlin/Unit.class
e: /Users/user/.pub-cache/hosted/pub.flutter-io.cn/audioplayers-0.18.3/android/src/main/kotlin/xyz/luan/audioplayers/AudioplayersPlugin.kt: (26, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from /Users/user/.gradle/caches/transforms-2/files-2.1/3b0753969d68ffd5874e4b39343d65d1/jetified-kotlin-stdlib-1.5.10.jar!/kotlin/Unit.class
e: /Users/user/.pub-cache/hosted/pub.flutter-io.cn/audioplayers-0.18.3/android/src/main/kotlin/xyz/luan/audioplayers/AudioplayersPlugin.kt: (27, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from /Users/user/.gradle/caches/transforms-2/files-2.1/3b0753969d68ffd5874e4b39343d65d1/jetified-kotlin-stdlib-1.5.10.jar!/kotlin/Unit.class
e: /Users/user/.pub-cache/hosted/pub.flutter-io.cn/audioplayers-0.18.3/android/src/main/kotlin/xyz/luan/audioplayers/AudioplayersPlugin.kt: (28, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
The class is loaded from /Users/user/.gradle/caches/transforms-2/files-2.1/3b0753969d68ffd5874e4b39343d65d1/jetified-kotlin-stdlib-1.5.10.jar!/kotlin/Unit.class
FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':audioplayers:compileReleaseKotlin'.         
> 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 23s                                                     
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                      24.7s

解决方案:

方案1:

在您的项目级 gradle 文件中,只需将 ext.kotlin.version 从您拥有的任何版本增加到“1.4.32”或任何可用的最新版本。
路径:/android/build.gradle
示例:

buildscript {
    ext.kotlin_version = '1.4.32'
    repositories {
        google()
        jcenter()
    }

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

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

相关文章

网友评论

      本文标题:Flutter Android 打包报错:Module was

      本文链接:https://www.haomeiwen.com/subject/xwfleltx.html