Closed cullsin closed 3 months ago
Having the same issue on Mac also compiling for android.
node -v
v21.4.0
npm -v
10.2.5
I solved the issue by installing the JDK 11 on my Mac.
I had the same problem when I used JDK 21. I tried to use JDK 11, but my current project requires a minimum version of JDK 17. I downgraded my JDK version to JDK 17 and solved this problem
@cullsin @yaotutu @ttruongatl @tri-bao To fix this ,follow these step 1) remove apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle") from android/app/build.gradlew 2) go to node_modules/react-native-vector-icon/Fonts and copy all the fonts 3) go to android/app/src/main and create a folder named assets if not exist then inside then assets create one more folder named fonts and paste all the fonts from node_modules/react-native-vector-icon/Fonts to here 4) now you can use the vector icon as usual and also you can create a build which won't failed
You need to be on a lower version of Java, you can check this by running
npx react-native doctor
When using Java 21 you will get this
npx react-native doctor ─╯
Common
✓ Node.js - Required to execute JavaScript code
✓ npm - Required to install NPM dependencies
✓ Watchman - Used for watching changes in the filesystem when in development mode
✓ Metro - Required for bundling the JavaScript code
Android
✓ Adb - Required to verify if the android device is attached correctly
✖ JDK - Required to compile Java code
- Version found: 21.0.1
- Version supported: >= 17 <= 20
✓ Android Studio - Required for building and installing your app on Android
✓ ANDROID_HOME - Environment variable that points to your Android SDK installation
✓ Gradlew - Build tool required for Android builds
✓ Android SDK - Required for building and installing your app on Android
iOS
✓ Xcode - Required for building and installing your app on iOS
✓ Ruby - Required for installing iOS dependencies
✓ CocoaPods - Required for installing iOS dependencies
● ios-deploy - Required for installing your app on a physical device with the CLI
✓ .xcode.env - File to customize Xcode environment
Errors: 1
Warnings: 1
Usage
› Press f to try to fix issues.
› Press e to try to fix errors.
› Press w to try to fix warnings.
› Press Enter to exit.
My advice would be to use SDKMan and install a version lower than 21, the best would be to follow what RN advises, see this At the moment of writing it is 17.0.9
sdk install java 17.0.9-zulu
You can set it as your default, or change it on the fly by using
sdk use java 17.0.9-zulu
@ttruongatl what happen ??
BUILD FAILED in 16s failed with an exception. What went wrong: Execution failed for task ':react-native-vector-icons:compileDebugJavaWithJavac'. > Could not resolve all files for configuration ':react-native-vector-icons: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\SHIVAM\AppData\Local\Andriod\Sdk\platforms\android-34\core-for-system-modules.jar. > Error while executing process C:\Program Files\OpenLogic\jdk-21.0.2\bin\jlink.exe with arguments {--module-path C:\Users\SHIVAM.gradle\caches\transforms-3\393400499b2af28f59d755a5f301569b\transformed\output\temp\jmod --add-modules java.base --output C:\Users\SHIVAM.gradle\caches\transforms-3\393400499b2af28f59d755a5f301569b\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 16s. info Run CLI with --verbose flag for more details.
I got this error ,after installing npm install --save react-native-vector-icons
I have similar problem. I have JAVA 17 in the environment, but the react-native doctor seems not able to detect.
From cml:
~ java --version openjdk 17.0.11 2024-04-16 LTS OpenJDK Runtime Environment Zulu17.50+19-CA (build 17.0.11+9-LTS) OpenJDK 64-Bit Server VM Zulu17.50+19-CA (build 17.0.11+9-LTS, mixed mode, sharing)
From react-native doctor :
Android ✖ Adb - No devices and/or emulators connected. Please create emulator with Android Studio or connect Android device. ✖ JDK - Required to compile Java code
- Version found: 21.0.2
- Version supported: >= 17 <= 20 ✓ Android Studio - Required for building and installing your app on Android ✓ ANDROID_HOME - Environment variable that points to your Android SDK installation ✓ Gradlew - Build tool required for Android builds ✖ Android SDK - Required for building and installing your app on Android
- Versions found: N/A
- Version supported: 34.0.0`
I had the same problem when I used JDK 21. I tried to use JDK 11, but my current project requires a minimum version of JDK 17. I downgraded my JDK version to JDK 17 and solved this problem
how do i downgrade the version of JDK? i already download and set the path to the environment variable but the react native project just dont change the java 22 to java 20
CThe consensus here seems to be a java version issue, please refer to React Native docs to debug.
Hi,
I am using
"react-native-vector-icons": "^10.0.3"
inwindows
. I am getting the below build error. Please suggest.What went wrong: