Execution failed for task ':react-native-async-storage_async-storage:compileDebugJavaWithJavac'
mehmettasan opened this issue · comments
What happened?
when i install this package i get this error:
`FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':react-native-async-storage_async-storage:compileDebugJavaWithJavac'.
Could not resolve all files for configuration ':react-native-async-storage_async-storage: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: C:\Users\mehmet\AppData\Local\Android\Sdk\platforms\android-34\core-for-system-modules.jar.
> Error while executing process C:\Program Files\Java\jdk-21\bin\jlink.exe with arguments {--module-path C:\Users\mehmet.gradle\caches\transforms-4\f4982565bdb55b9941b39bd9a33cd0b1-894473a1-c334-41eb-958c-d197a337126f\transformed\output\temp\jmod --add-modules java.base --output C:\Users\mehmet.gradle\caches\transforms-4\f4982565bdb55b9941b39bd9a33cd0b1-894473a1-c334-41eb-958c-d197a337126f\transformed\output\jdkImage --disable-plugin system-modules}
- Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.
BU�LD FAILED in 13s
error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':react-native-async-storage_async-storage:compileDebugJavaWithJavac'. > Could not resolve all files for configuration ':react-native-async-storage_async-storage: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: C:\Users\mehmet\AppData\Local\Android\Sdk\platforms\android-34\core-for-system-modules.jar. > Error while executing process C:\Program Files\Java\jdk-21\bin\jlink.exe with arguments {--module-path C:\Users\mehmet.gradle\caches\transforms-4\f4982565bdb55b9941b39bd9a33cd0b1-894473a1-c334-41eb-958c-d197a337126f\transformed\output\temp\jmod --add-modules java.base --output C:\Users\mehmet.gradle\caches\transforms-4\f4982565bdb55b9941b39bd9a33cd0b1-894473a1-c334-41eb-958c-d197a337126f\transformed\output\jdkImage --disable-plugin system-modules} * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BU�LD FAILED in 13s.`
Version
1.21.0
What platforms are you seeing this issue on?
- Android
- iOS
- macOS
- Windows
- web
System Information
System:
OS: Windows 11 10.0.22621
CPU: (8) x64 Intel(R) Core(TM) i5-10300H CPU @ 2.50GHz
Memory: 3.89 GB / 15.84 GB
Binaries:
Node:
version: 18.16.0
path: C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm:
version: 9.6.5
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels:
- "31"
- "33"
- "34"
Build Tools:
- 30.0.3
- 31.0.0
- 33.0.0
- 33.0.1
- 33.0.2
- 34.0.0
System Images:
- android-31 | Google APIs Intel x86 Atom_64
- android-33 | Google APIs Intel x86_64 Atom
- android-34 | Intel x86_64 Atom
- android-34 | Google APIs Intel x86_64 Atom
Android NDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: AI-222.4459.24.2221.9971841
Visual Studio: Not Found
Languages:
Java: 21.0.2
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.3
wanted: 0.73.3
react-native-windows: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Steps to Reproduce
when i install this package
Latest RN (0.73.3) is using Gradle 8.3, which is not compatible with JDK 21.
This is not related to Async Storage, but your setup - best to downgrade JDK, 17 is fine
@krizzu Thanks for the solution its working fine!
for someone like me who encountered this error, i have a jdk version 21 installed, instead of deleting that, you can use sdkmanager or we can use brew.
brew install openjdk@17
after that see where it outputs
Matching Java Virtual Machines (2):
21.0.2 (arm64) "Oracle Corporation" - "Java SE 21.0.2" /Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home
17.0.10 (arm64) "Homebrew" - "OpenJDK 17.0.10" /opt/homebrew/Cellar/openjdk@17/17.0.10/libexec/openjdk.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home
link it with this
sudo ln -sfn /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
and you're good to go now.
System:
OS: macOS 14.3.1
CPU: (8) arm64 Apple M1
Memory: 118.47 MB / 8.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 21.7.1
path: /usr/local/bin/node
Yarn:
version: 1.22.22
path: /usr/local/bin/yarn
npm:
version: 10.5.0
path: /usr/local/bin/npm
Watchman:
version: 2024.03.18.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /Users/hades/.rvm/gems/ruby-3.0.0/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.4
- iOS 17.4
- macOS 14.4
- tvOS 17.4
- visionOS 1.1
- watchOS 10.4
Android SDK:
API Levels:
- "31"
- "33"
- "34"
Build Tools:
- 30.0.3
- 31.0.0
- 33.0.1
- 33.0.2
- 34.0.0
System Images:
- android-34 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2023.2 AI-232.10227.8.2321.11479570
Xcode:
version: 15.3/15E204a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 21.0.2
path: /usr/bin/javac
Ruby:
version: 3.0.0
path: /Users/hades/.rvm/rubies/ruby-3.0.0/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.6
wanted: 0.73.6
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
@H4D3ZS yes by downgrading the java version to 20 or 17 it will works fine , thats fine approach.
for me i was missing
brew tap homebrew/cask-versions
brew install --cask zulu17
# Get path to where cask was installed to double-click installer
brew info --cask zulu17
then adding java home
After you install the JDK, update your JAVA_HOME environment variable. If you used above steps, JDK will likely be at /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home
I need some help here...
I still have this issue, although I (guess) have JDK17 installed, when I type java -version
I get the following:
java version "17.0.10" 2024-01-16 LTS
Java(TM) SE Runtime Environment (build 17.0.10+11-LTS-240)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.10+11-LTS-240, mixed mode, sharing)
running /usr/libexec/java_home -V
yields:
Matching Java Virtual Machines (3):
22 (x86_64) "Oracle Corporation" - "Java SE 22" /Library/Java/JavaVirtualMachines/jdk-22.jdk/Contents/Home
17.0.10 (x86_64) "Oracle Corporation" - "Java SE 17.0.10" /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home
1.8.0_211 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-22.jdk/Contents/Home
Am I missing something?
@paicolman try with 20 or 11 also