dev #945
openBuild Error on Task `:shared_preferences_android:compileDebugJavaWithJavac`
100%
Description
When running a build, the following error occurs:
execution failed for task ':shared_preferences_android:compileDebugJavaWithJavac'. > Could not resolve all files for configuration ':shared_preferences_android:androidJdkImage'.
Steps to Reproduce¶
- Run the build or launch the app.
- Observe the error during the compilation phase of
shared_preferences_android.
Expected Behavior¶
The build should complete successfully without errors.
Actual Behavior¶
The build fails with an error related to :shared_preferences_android:compileDebugJavaWithJavac due to issues resolving androidJdkImage.
Updated by Najmul Hasan over 1 year ago ยท Edited
Resolution¶
This issue was resolved by:
-
Ensuring
app/build.gradleconfigurations are compatible:ndkVersion = "25.1.8937393"compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 }-
jvmTargetset to17
-
Ensuring
android/settings.gradleconfigurations are compatible:- id "com.android.application" version "8.3.2" apply false
- id "org.jetbrains.kotlin.android" version "2.0.20" apply false
-
Updating the
android/gradle/gradle-wrapperdistribution URL to use version8.10.2distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
-
Clearing the build cache with
flutter cleanand running a new build.
If the issue persists, ensure all dependencies support Java 17 and consider updating the shared_preferences package to the latest version.