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
There have been changes in the new versions of this file. Now your file has the following changes with my file:
}
Change these and then:
With these changes my project works properly.
This is due to Android studio Lady bug 2024.2 using JDK 21 instead of JDK 17 by default , there are two solutions:
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
Do it manually by following this link How to fix Android Compilation issues