skip to Main Content

I am working on a Flutter project and recently upgraded my Android Studio, Java versions and also the gradle version in gradle-wrapper.properties file to the latest

In gradle-wrapper.properties file:

distributionUrl=https://services.gradle.org/distributions/gradle-8.10.2-all.zip

Error log while building app:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':connectivity_plus:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':connectivity_plus: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}.
      > Execution failed for JdkImageTransform: /Users/..../Library/Android/sdk/platforms/android-34/core-for-system-modules.jar.
         > Error while executing process /Users/..../Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/jlink with arguments {--module-path /Users/malwinder/.gradle/caches/8.10.2/transforms/057cd3d70c61a40076a3bbfe497a8e16-0d4425f6-230d-4e42-a5da-d5def5f24a35/transformed/output/temp/jmod --add-modules java.base --output /Users/..../.gradle/caches/8.10.2/transforms/057cd3d70c61a40076a3bbfe497a8e16-0d4425f6-230d-4e42-a5da-d5def5f24a35/transformed/output/jdkImage --disable-plugin system-modules}

Android Studio:

Android Studio Ladybug | 2024.2.1
Build #AI-242.21829.142.2421.12409432, built on September 25, 2024
Runtime version: 21.0.3+-79915917-b509.11 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.lwawt.macosx.LWCToolkit
macOS 15.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 4096M
Cores: 8
Metal Rendering is ON
Registry:
  ide.balloon.shadow.size=0
  debugger.new.tool.window.layout=true
  ide.new.editor.tabs.vertical.borders=true
  ide.animate.toolwindows=true
  ide.experimental.ui=true
  ide.editor.tab.selection.animation=true
  i18n.locale=
Non-Bundled Plugins:
  com.chylex.intellij.inspectionlens (1.4.1)
  com.jetbrains.gerryPurpleTheme (2024.1.0920)
  com.zll.format (2.2)
  IdeaVIM (2.16.0)
  dev.willebrands.intellij.sloppyfocus (0.9.0)
  Dart (242.21829.3)
  PlantUML integration (7.11.2-IJ2023.2)
  com.bloc.intellij_generator_plugin (4.0.2)
  com.flutter_create_stateful_widget (1.5)
  andrasferenczi.dart-data-plugin (0.2.0)
  com.markskelton.one-dark-theme (5.12.0)
  com.ankit.mahadik.json.dart.class (2.16)
  com.intellij.marketplace (242.21829.233)
  com.localizely.flutter-intl (1.18.5-2023.2)
  Key Promoter X (2024.2.0)
  com.herbert.george.dart.extensions (0.0.1+3)
  com.jiajun.flutter_add_image (1.7)
  com.shuzijun.markdown-editor (2.0.5)
  com.herbert.george.flutter-snippets (2.0.0-stable-1)
  com.eggnstone.jetbrainsplugins.DartFormat (2.0.20)
  Docker (242.21829.162)
  izhangzhihao.rainbow.brackets (2024.2.6-241)
  cn.yiiguxing.plugin.translate (3.6.6)
  pl.pszklarska.pubversionchecker (1.3.5)
  com.chrisrm.idea.MaterialThemeUI (9.5.0)
  com.developerphil.adbidea (1.6.18)
  com.github.kikimanjaro.stickyscroll (0.0.2)
  com.github.copilot (1.5.24.6927-nightly)
  org.intellij.qodana (242.21829.57)
  com.mallowigi (97.0.0)
  mobi.hsz.idea.gitignore (4.5.3)
  io.flutter (81.1.3)
  com.crzsc.FlutterAssetsGenerator (2.4.2)
  de.mariushoefler.flutter_enhancement_suite (1.7.1)
  com.ruiyu.ruiyu (5.2.1)

Running MacOS Sequoia (Version 15.0)

I think this issue is related to https://pub.dev/packages/connectivity_plus package

More details: https://github.com/fluttercommunity/plus_plugins/issues/3299

2

Answers


  1. Chosen as BEST ANSWER

    Fixed issue by using:

       id "com.android.application" version "8.7.0" apply false
    

    in plugins block In android/settings.gradle

    Also set in gradle-wrapper.properties:

    distributionUrl=https://services.gradle.org/distributions/gradle-8.10.2-all.zip
    

    Currently using Java version:

    java version "1.8.0_301"
    

  2. the accepted answer doesn’t work for me, but finally I figured it out by this command:

    flutter config --jdk-dir  /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/home
    

    change the argument to your own JDK path.

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