Project

General

Profile

Actions

dev #945

open

Build Error on Task `:shared_preferences_android:compileDebugJavaWithJavac`

Added by Najmul Hasan over 1 year ago. Updated over 1 year ago.

Status:
Complete
Priority:
High
Assignee:
Target version:
Start date:
11/11/2024
Due date:
11/11/2024 (about 17 months late)
% Done:

100%

Estimated time:
2:00 h
Spent time:

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

  1. Run the build or launch the app.
  2. 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.

Actions #1

Updated by Najmul Hasan over 1 year ago ยท Edited

Resolution

This issue was resolved by:

  • Ensuring app/build.gradle configurations are compatible:

    • ndkVersion = "25.1.8937393"
    • compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 }
    • jvmTarget set to 17
  • Ensuring android/settings.gradle configurations 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-wrapper distribution URL to use version 8.10.2

    • distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
  • Clearing the build cache with flutter clean and 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.

Actions #2

Updated by Najmul Hasan over 1 year ago

  • Due date set to 11/11/2024
Actions

Also available in: Atom PDF