'Properly configure JDK to run react native project
I am trying to run a react native app on a m1 mac, generated with react-native-starter-kit.enter link description here. When I run the app with npx react-native run-android, I get the following error
error Failed to install the app. Please accept all necessary Android SDK licenses using Android SDK Manager: "$ANDROID_HOME/tools/bin/sdkmanager --licenses".
I tried to run the sdkmanager as following
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home
cd ~/Library/Android/sdk/tools/bin/
./sdkmanager --licenses
I get an Error
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
Then I tried this JAVA_HOME
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
cd ~/Library/Android/sdk/tools/bin/
./sdkmanager --licenses
And it works, All SDK package licenses accepted.======] 100% Computing updates...
But when I run npx react-native run-android after that, I still have a licence error
Failed to install the app. Please accept all necessary Android SDK licenses using Android SDK Manager
I have the feeling I am accepting the licenses in the wrong JDK. Any idea?
Solution 1:[1]
You should make sure that you set up you development envoirement the correct way.
The Official Guide explains it step by step.
For you paragraph 2 (Install the Android SDK) should be helpful
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | JaRoMaster |
