Execution failed for task ':react-native-async-storage_async-storage:compileDebugJavaWithJavac'

733 views Asked by At

When I use Asyncstorage i'm getting this error when i run for android and when i unistall the package then then build is successfull can anyone help what should I do?


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\sinha\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\sinha\.gradle\caches\transforms-3\39249073bb6a3501d7fccc77a4a99ba2\transformed\output\temp\jmod --add-modules java.base --output C:\Users\sinha\.gradle\caches\transforms-3\39249073bb6a3501d7fccc77a4a99ba2\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.

BUILD FAILED in 38s

I'm using latest version of react naive

I'm using latest version of react naive

1

There are 1 answers

1
Jogy Felix On

I've faced the same issue and resolved it by retaining only JDK 17. It appears to be connected to the JDK, so if you have multiple JDK versions installed, remove the extras and retain only the necessary one.

According to the React Native documentation, JDK 17 is the recommended version.