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?
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
Related
I have a problem to run flutter app from VS Code,
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module #0x3d67da21) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module #0x3d67da21
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 3s
Exception: Gradle task assembleDebug failed with exit code 1
What flutter doctor said :
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-arm, locale
en-RS)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[!] Android Studio
✗ **Unable to find bundled Java version.**
[✓] Connected device (2 available)
I resolved it on my side by creating a symbolic link:
cd /Applications/Android\ Studio.app/Contents/jre;
ln -s ../jre jdk;
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
Not the most elegant solution, but worked. the problem is that the system finds two java versions, and either the android licenses are not accepted, or the bundled version is not found. So instead I removed the link and added an other one. and that finally did the trick
source: https://github.com/flutter/flutter/issues/27136#issuecomment-888915746
I think you should specify the path to your Java SDK in Android Studio, you can set it by doing the following:
Generally speaking, it is set in the "Project Structure" dialog.
Go to File > Project Structure > SDK Location. The third field is "JDK
Location" where you can set it. This will set it for the current
project.
How to set Java SDK path in AndroidStudio?
I've been trying to launch a basic app using react native. So far, I've followed the guide here, https://reactnative.dev/docs/environment-setup, for react-native CLI quickstart. I'm using Windows, and using bash with Windows linux subsystem (ubuntu)
I've launched metro, but when I try the command,
npx react-native run-android --no-jetifier
I get the following error,
info JS server already running.
info Installing the app...
"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081"
I've tried setting a path to the JRE location used by Android Studio, and also setting the path to C:\Program Files\Java\jre1.8.0_241, restarted etc.
Any insights?
I should add, when I try to launch the app through android studio (on an emulator) it gives this error,
Unable to load script. Make sure you're either running a metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release
Set JAVA_HOME but also, consider adding the bin to the PATH system variable
C:\Program Files\Java\jre1.8.0_241\bin
Find more information here https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html
My react native android was compiling fine until I added react-native-firebase as per the docs (ios compiles fine).
React Native 0.63.2 and react-native-firebase 8.3.0 latest versions
and followed docs very carefully. OSX 10.15.6
Deleted/cleared/reinstalled gradle and android gradle/build dirs etc.
java JRE v8.202 /Library/Internet Plug-Ins/JavaAppletPlugin.plugin
java JRE v8.202 /Library/Java/JavaVirtualMachines
Note that JAVA_HOME path set to /Applications/AndroidStudio.app/Contents/jre/jd/Contents/Home
Error:
> Task :react-native-firebase_app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-firebase_app:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
I'm using Mac Bigsur beta 4, and I have the same problem.
I tried uninstalling java by following the steps in this link:
https://www.java.com/en/download/help/mac_uninstall_java.xml
After that I checked the java version in terminal using: java -version.
The uninstall process didn't work. However, running react-native run-android now works.
Try this. It may work for you.
Note: If you tried uninstalling java, and running react-native run-android still doesn't work, add this to bash_profile and try again: export JAVA_HOME=/Applications/AndroidStudio.app/Contents/jre/jdk/Contents/Home
Ran source ~/.bash_profile to ensure JAVA_HOME path set to /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home and it compiled, yay.
I am getting the following error when trying to install Android Studio 3.1 Preview 2 on Windows:
Error: CreateProcess error=216, This version of %1 is not compatible
with the version of Windows you're running. Check your computer's
system information and then contact the software publisher.
I have tried to install the following - but still didn't help:
Install jdk1.8.
I also tried the following in Android Studio:
File->Project Structure->SDK Location (select your directory where the JDK is located, by default Studio uses embedded JDK) -> Click OK
But for some reason this produces error=216.
I did the following and I am getting the error message
I installed Apache Ant using the command npm install apache ant
I updated my Cordova to the latest version, 3.4.0 by the command npm -g update phonegap
I updated the system variables so the /bin directory of Java SDK and the /bin of Apache Ant is included in the PATH
I updated my Android SDK and included Google API Ver 19
And I am still getting the following error message! You can open the image on new tab or save the image so you can view the message more clearly
I tried running check_reqs and it only gave me one line which was
"An error occuured while listing Android targets"
"I updated my Cordova to the latest version, 3.4.0 by the command npm -g update phonegap"
Cordova and PhoneGap are two different things in terms of command line clients. Have you run npm -g install cordova? You need to have both for the phonegap client to work with local builds.