Flutter Android 打包報(bào)錯(cuò):Module was compiled with an incompatible version of Kotlin. The binary versi...

出現(xiàn)問題:

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:

在您的項(xiàng)目級(jí) 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()
    }
}
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末强经,一起剝皮案震驚了整個(gè)濱河市匿情,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌汁果,老刑警劉巖,帶你破解...
    沈念sama閱讀 218,607評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件据德,死亡現(xiàn)場(chǎng)離奇詭異棘利,居然都是意外死亡善玫,警方通過查閱死者的電腦和手機(jī)密强,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,239評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門系冗,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人毕谴,你說我怎么就攤上這事⊙剩” “怎么了?”我有些...
    開封第一講書人閱讀 164,960評(píng)論 0 355
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)瘪匿。 經(jīng)常有香客問我,道長(zhǎng)核偿,這世上最難降的妖魔是什么顽染? 我笑而不...
    開封第一講書人閱讀 58,750評(píng)論 1 294
  • 正文 為了忘掉前任,我火速辦了婚禮左腔,結(jié)果婚禮上液样,老公的妹妹穿的比我還像新娘。我一直安慰自己鞭莽,他們只是感情好撮抓,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,764評(píng)論 6 392
  • 文/花漫 我一把揭開白布丹拯。 她就那樣靜靜地躺著乖酬,像睡著了一般融求。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上县昂,一...
    開封第一講書人閱讀 51,604評(píng)論 1 305
  • 那天倒彰,我揣著相機(jī)與錄音莱睁,去河邊找鬼仰剿。 笑死,一個(gè)胖子當(dāng)著我的面吹牛南吮,可吹牛的內(nèi)容都是我干的琳彩。 我是一名探鬼主播,決...
    沈念sama閱讀 40,347評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼汁针!你這毒婦竟也來了术辐?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,253評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤施无,失蹤者是張志新(化名)和其女友劉穎辉词,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體猾骡,經(jīng)...
    沈念sama閱讀 45,702評(píng)論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡瑞躺,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,893評(píng)論 3 336
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了兴想。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片幢哨。...
    茶點(diǎn)故事閱讀 40,015評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖嫂便,靈堂內(nèi)的尸體忽然破棺而出捞镰,到底是詐尸還是另有隱情岸售,我是刑警寧澤,帶...
    沈念sama閱讀 35,734評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站腻惠,受9級(jí)特大地震影響妖枚,放射性物質(zhì)發(fā)生泄漏荠商。R本人自食惡果不足惜莱没,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,352評(píng)論 3 330
  • 文/蒙蒙 一臼隔、第九天 我趴在偏房一處隱蔽的房頂上張望摔握。 院中可真熱鬧,春花似錦盛正、人聲如沸豪筝。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,934評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)梢莽。三九已至,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間仑扑,已是汗流浹背蜓竹。 一陣腳步聲響...
    開封第一講書人閱讀 33,052評(píng)論 1 270
  • 我被黑心中介騙來泰國(guó)打工俱济, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留蛛碌,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,216評(píng)論 3 371
  • 正文 我出身青樓浮梢,卻偏偏與公主長(zhǎng)得像芥映,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子惊来,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,969評(píng)論 2 355