新的android studio更新是否导致问题?

问题描述 投票:0回答:1

我将 video_player 添加到我的 flutter 项目 pubspec.yaml 中,之后发生了这种情况:

Execution failed for task ':video_player_android:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':video_player_android:androidJdkImage'.
   > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.

此外,我将 Android Studio 更新为 Android Studio Lady Bug。

我的build.gradle文件:

plugins {
    id "com.android.application"
    id "kotlin-android"
    // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
    id "dev.flutter.flutter-gradle-plugin"
}

android {
    namespace = "com.example.meditation_app"
    compileSdk = flutter.compileSdkVersion
    ndkVersion = flutter.ndkVersion

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = '17'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId = "com.example.//"
        // You can update the following values to match your application needs.
        // For more information, see: https://flutter.dev/to/review-gradle-config.
        minSdk = flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }

    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 = "../.."
}

我正在使用 ggradle-8.3-all.zip 。 有什么解决办法吗?

我什么都没做。

android flutter gradle
1个回答
0
投票

此文件的新版本已发生更改。现在您的文件与我的文件有以下更改:

compileOptions {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8

}

kotlinOptions {
    jvmTarget = JavaVersion.VERSION_1_8
}

更改这些,然后:

flutter clean
flutter pub get

通过这些更改,我的项目可以正常运行。

© www.soinside.com 2019 - 2024. All rights reserved.