skip to Main Content

I added video_player to my flutter project pubspec.yaml and after that, this happened:

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}.

Also, I updated my Android Studio to Android Studio Lady Bug.

my build.gradle file:

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

and I’m using ggradle-8.3-all.zip .
any solution?

I totally do nothing.

2

Answers


  1. There have been changes in the new versions of this file. Now your file has the following changes with my file:

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

    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8
    }
    

    Change these and then:

    flutter clean
    flutter pub get
    

    With these changes my project works properly.

    Login or Signup to reply.
  2. This is due to Android studio Lady bug 2024.2 using JDK 21 instead of JDK 17 by default , there are two solutions:

    1. Downgrade to Android studio 2024.1 and wait until Flutter team throw an update to Flutter so that it can upgrade all the android dependencies to work with JDK 21

    2. Do it manually by following this link How to fix Android Compilation issues

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search