react-native-async-storage / async-storage

An asynchronous, persistent, key-value storage system for React Native.
https://react-native-async-storage.github.io/async-storage/
MIT License
4.61k stars 459 forks source link

react-native-async-storage_async-storage:compileDebugJavaWithJavac FAILED #1049

Closed Bhavesh1236 closed 6 months ago

Bhavesh1236 commented 6 months ago

npx react-native run-android version info "@react-native-async-storage/async-storage": "^1.21.0", "react": "18.2.0", "react-native": "0.73.1",

Task :react-native-async-storage_async-storage:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

ArtemLakhurov commented 5 months ago

@Bhavesh1236 Hi, how did you solve this issue?

Bhavesh1236 commented 5 months ago

Update Android gradle file jdk version

In ansync storage is use old JDK version and many other library are also like firebase.

On Tue, 23 Jan, 2024, 7:34 pm Artem Lakhurov, @.***> wrote:

@Bhavesh1236 https://github.com/Bhavesh1236 Hi, how did you solve this issue?

— Reply to this email directly, view it on GitHub https://github.com/react-native-async-storage/async-storage/issues/1049#issuecomment-1906127188, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYMP6F3QM3OOSWG3J4IAS4DYP67OXAVCNFSM6AAAAABBECCZLKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBWGEZDOMJYHA . You are receiving this because you were mentioned.Message ID: @.*** com>

huzaifaumer01 commented 5 months ago

"dependencies": { "@react-native-async-storage/async-storage": "^1.21.0", "@react-native-community/netinfo": "^11.2.1", "@react-navigation/bottom-tabs": "^6.5.11", "@react-navigation/native": "^6.1.9", "@react-navigation/native-stack": "^6.9.17", "@walletconnect/react-native-compat": "^2.11.0", "@web3modal/wagmi-react-native": "^1.1.1", "react": "18.2.0", "react-native": "0.73.2", "react-native-gesture-handler": "^2.14.1", "react-native-get-random-values": "^1.10.0", "react-native-modal": "^13.0.1", "react-native-safe-area-context": "^4.8.2", "react-native-screens": "^3.29.0", "react-native-svg": "^14.1.0", "viem": "^1.21.4", "wagmi": "^1.4.13" }

Same issue when it try to install and run "@react-native-async-storage/async-storage". its run on IOS without error but return error on Android side.

Task :react-native-async-storage_async-storage:compileDebugJavaWithJavac FAILED
  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: /Users/armup/Library/Android/sdk/platforms/android-34/core-for-system-modules.jar.
         > Error while executing process /opt/homebrew/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home/bin/jlink with arguments {--module-path /Users/armup/.gradle/caches/transforms-3/ab2fc22cb32e16b9d572bdcb2e01e34e/transformed/output/temp/jmod --add-modules java.base --output /Users/username/.gradle/caches/transforms-3/ab2fc22cb32e16b9d572bdcb2e01e34e/transformed/output/jdkImage --disable-plugin system-modules}
Bhavesh1236 commented 5 months ago

In my case use JDK 11 use

Same project configuration.

On Wed, 24 Jan, 2024, 12:29 pm huzaifaumer01, @.***> wrote:

"dependencies": { @./async-storage": "^1.21.0", @./netinfo": "^11.2.1", @./bottom-tabs": "^6.5.11", @./native": "^6.1.9", @./native-stack": "^6.9.17", @./react-native-compat": "^2.11.0", @.***/wagmi-react-native": "^1.1.1", "react": "18.2.0", "react-native": "0.73.2", "react-native-gesture-handler": "^2.14.1", "react-native-get-random-values": "^1.10.0", "react-native-modal": "^13.0.1", "react-native-safe-area-context": "^4.8.2", "react-native-screens": "^3.29.0", "react-native-svg": "^14.1.0", "viem": "^1.21.4", "wagmi": "^1.4.13" }

Same issue when it try to install and run @.***/async-storage". its run on IOS without error but return error on Android side.

Task :react-native-async-storage_async-storage:compileDebugJavaWithJavac FAILED 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: /Users/armup/Library/Android/sdk/platforms/android-34/core-for-system-modules.jar. Error while executing process /opt/homebrew/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home/bin/jlink with arguments {--module-path /Users/armup/.gradle/caches/transforms-3/ab2fc22cb32e16b9d572bdcb2e01e34e/transformed/output/temp/jmod --add-modules java.base --output /Users/username/.gradle/caches/transforms-3/ab2fc22cb32e16b9d572bdcb2e01e34e/transformed/output/jdkImage --disable-plugin system-modules}

— Reply to this email directly, view it on GitHub https://github.com/react-native-async-storage/async-storage/issues/1049#issuecomment-1907483398, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYMP6F7E7FEL4IGRA6YBUL3YQCWOZAVCNFSM6AAAAABBECCZLKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBXGQ4DGMZZHA . You are receiving this because you were mentioned.Message ID: @.*** com>

jamiesunderland commented 5 months ago

Why is this closed? At the very least, I think should be documented as in 0.73 this is now the suggested in module by RN docs for AsyncStorage.

marksyzm commented 5 months ago

I managed to get this working while running directly in Android Studio with JDK 17:

Screenshot 2024-02-02 at 19 20 41

But the same config fails when running in CLI. How do I set the JDK there? Otherwise this could probably do with being reopened as it's not operational with expo >= 49

marksyzm commented 5 months ago

Yep, figured it out. So whilst he's running a sandboxed version of java in Android Studio, the CLI is, of course, using what's installed on the local machine. Version 21 of java breaks stuff here, so I had to downgrade to version 17. In my case I used this to downgrade: https://sdkman.io/