最近我將我的顫振升級到 2.9.0-0.1.pre 并將飛鏢升級到 2.16.0 但存在問題和問題:我可以創建和運行新專案但我的舊顫振專案無法構建并顯示這些錯誤!我也創建了新專案并將舊專案檔案移動到新專案,但錯誤仍然存??在錯誤:
e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
e: /Users/systemName/.gradle/caches/transforms-2/files-2.1/06445d7ee3d674db365da5b7e383aeec/jetified-window-1.0.0-beta04-api.jar!/META-INF/window_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/systemName/.gradle/caches/transforms-2/files-2.1/185d46b6321985f52dcc07c04b9e0199/jetified-kotlin-stdlib-common-1.5.31.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/systemName/.gradle/caches/transforms-2/files-2.1/57fff25d753f492b2e9dfa8a7a25a127/jetified-kotlin-stdlib-jdk7-1.5.30.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.5.1, expected version is 1.1.15.
e: /Users/systemName/.gradle/caches/transforms-2/files-2.1/7ed1fc227d449123990dfe95b91bbf13/jetified-kotlin-stdlib-1.5.31.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/systemName/.gradle/caches/transforms-2/files-2.1/989d7c521cad3a1e2e82ee6a7a836f54/jetified-kotlinx-coroutines-android-1.5.2.jar!/META-INF/kotlinx-coroutines-android.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/systemName/.gradle/caches/transforms-2/files-2.1/9c675fcd73ec0913dfa5836b73d5959f/jetified-window-java-1.0.0-beta04-api.jar!/META-INF/window-java_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/systemName/.gradle/caches/transforms-2/files-2.1/cdd51607f1d98bcc689bce197d763afe/jetified-kotlin-stdlib-jdk8-1.5.30.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.5.1, expected version is 1.1.15.
e: /Users/systemName/.gradle/caches/transforms-2/files-2.1/ced2a85cd1d4e10ca7b42bb11579f9f7/jetified-kotlinx-coroutines-core-jvm-1.5.2.jar!/META-INF/kotlinx-coroutines-core.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/systemName/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.6/android/src/main/kotlin/creativemaybeno/wakelock/Wakelock.kt: (23, 5): 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/systemName/.gradle/caches/transforms-2/files-2.1/7ed1fc227d449123990dfe95b91bbf13/jetified-kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: /Users/systemName/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.6/android/src/main/kotlin/creativemaybeno/wakelock/Wakelock.kt: (24, 37): 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/systemName/.gradle/caches/transforms-2/files-2.1/7ed1fc227d449123990dfe95b91bbf13/jetified-kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: /Users/systemName/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.6/android/src/main/kotlin/creativemaybeno/wakelock/Wakelock.kt: (26, 23): 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/systemName/.gradle/caches/transforms-2/files-2.1/7ed1fc227d449123990dfe95b91bbf13/jetified-kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: /Users/systemName/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.6/android/src/main/kotlin/creativemaybeno/wakelock/Wakelock.kt: (36, 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/systemName/.gradle/caches/transforms-2/files-2.1/7ed1fc227d449123990dfe95b91bbf13/jetified-kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: /Users/systemName/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.6/android/src/main/kotlin/creativemaybeno/wakelock/WakelockPlugin.kt: (16, 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/systemName/.gradle/caches/transforms-2/files-2.1/7ed1fc227d449123990dfe95b91bbf13/jetified-kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: /Users/systemName/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.6/android/src/main/kotlin/creativemaybeno/wakelock/WakelockPlugin.kt: (17, 5): 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/systemName/.gradle/caches/transforms-2/files-2.1/7ed1fc227d449123990dfe95b91bbf13/jetified-kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: /Users/systemName/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.6/android/src/main/kotlin/creativemaybeno/wakelock/WakelockPlugin.kt: (21, 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/systemName/.gradle/caches/transforms-2/files-2.1/7ed1fc227d449123990dfe95b91bbf13/jetified-kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: /Users/systemName/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.6/android/src/main/kotlin/creativemaybeno/wakelock/WakelockPlugin.kt: (22, 5): 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/systemName/.gradle/caches/transforms-2/files-2.1/7ed1fc227d449123990dfe95b91bbf13/jetified-kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: /Users/systemName/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.6/android/src/main/kotlin/creativemaybeno/wakelock/WakelockPlugin.kt: (26, 15): 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/systemName/.gradle/caches/transforms-2/files-2.1/7ed1fc227d449123990dfe95b91bbf13/jetified-kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: /Users/systemName/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.6/android/src/main/kotlin/creativemaybeno/wakelock/WakelockPlugin.kt: (30, 15): 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/systemName/.gradle/caches/transforms-2/files-2.1/7ed1fc227d449123990dfe95b91bbf13/jetified-kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: /Users/systemName/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.6/android/src/main/kotlin/creativemaybeno/wakelock/WakelockPlugin.kt: (34, 5): 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/systemName/.gradle/caches/transforms-2/files-2.1/7ed1fc227d449123990dfe95b91bbf13/jetified-kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: /Users/systemName/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.6/android/src/main/kotlin/creativemaybeno/wakelock/WakelockPlugin.kt: (38, 5): 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/systemName/.gradle/caches/transforms-2/files-2.1/7ed1fc227d449123990dfe95b91bbf13/jetified-kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
e: /Users/systemName/.pub-cache/hosted/pub.dartlang.org/wakelock-0.5.6/android/src/main/kotlin/creativemaybeno/wakelock/WakelockPlugin.kt: (42, 16): 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/systemName/.gradle/caches/transforms-2/files-2.1/7ed1fc227d449123990dfe95b91bbf13/jetified-kotlin-stdlib-1.5.31.jar!/kotlin/Unit.class
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':wakelock:compileDebugKotlin'.
> 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 15s
[!] Your project requires a newer version of the Kotlin Gradle plugin.
Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update /Users/systemName/AndroidStudioProjects/projectname/android/build.gradle:
ext.kotlin_version = '<latest-version>'
Exception: Gradle task assembleDebug failed with exit code 1
我的 build.gradle 檔案是:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs = 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
// applicationId "ri.mozayedekhodro.mozayedekhodro"
applicationId "vestasystem.ir.mozayede"
minSdkVersion 21
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
那么我怎樣才能為android修復這個錯誤呢?web 和 ios 可以運行,但 android 運行失敗
uj5u.com熱心網友回復:
您需要將 Kotlin 升級到 1.5.1 版本,但 Flutter 2.9.1 的最佳版本是 1.5.31。看這里。
buildscript {
- ext.kotlin_version = '1.1.15'
ext.kotlin_version = '1.5.1'
uj5u.com熱心網友回復:
你有兩種方法可以解決這個問題,首先:
Clicking on Gradle (on the right side bar) ->
Then under :app
Then choose assembleDebug (or assembleYourFlavor if you use flavors)
或者是因為您的網路:網路阻止了非安全的 http 下載請求。我改變了我的網路,gradle build 自己完成了。
uj5u.com熱心網友回復:
https://docs.flutter.dev/release/break-changes/kotlin-version
根據這個你需要更新kotlin版本到1.5.31里面<app-src>/android/build.gradle
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/405771.html
標籤:
