unable to start the android hello world app on mac
See original GitHub issueDescription
Hello, I’m new to react native and have problems to setup the hello world app. I followed the instruction on the „Getting Started“ page for installing android on mac.
First problems occur at „Starting the Android Virtual Device“ step.
$ android
outputs
The android command is no longer available. For manual SDK and AVD management, please use Android Studio. For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
Then I created a new empty project in Android Studio and startet the AVD using the menu > tools > android > AVD Manager. This window looks different to the one in the docs (see picture). There is no option named „Using Host GPU“. Only thing I’ve discovered was the Option „Graphcs“. I turned that from „automatic“ to „Hardware GLES 2.0“.
Then I started the emulator using the play button and run $ react-native run-android
.
Now I get the error:
… Skipping device ‘emulator-5554’ (emulator-5554): Device is UNAUTHORIZED, see http://d.android.com/tools/help/adb.html#Enabling. :app:installDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ‘:app:installDebug’. > com.android.builder.testing.api.DeviceException: No online devices found.
Hmf, no idea what the error means. Maybe its working with android studio.
Then I opened the folder AwesomeProject/android
using File > Open… in Android Studio
and hit the make Project button. Now I see the Error in the Console:
Error:The SDK Build Tools revision (23.0.1) is too low for project ‘:app’. Minimum required is 25.0.0
Then I plugged in my samsung s6 with usb debugging on and run $ react-native run-android
again. Now it appears:
NDK is missing a “platforms” directory. If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /Users/benny/Library/Android/sdk/ndk-bundle. If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
FAILURE: Build failed with an exception.
* What went wrong: A problem occurred configuring project ‘:app’. > The SDK Build Tools revision (23.0.1) is too low for project ‘:app’. Minimum required is 25.0.0
So what am I doing wrong? please help, thanks.
Reproduction
see steps above.
Solution
Please help me to find one.
Additional Information
- React Native version: 0.42.3
- Platform: Android
- Development Operating System: MacOS
- Dev tools: Android Studio 2.3 (build Feb 24 2017)
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (2 by maintainers)
For anyone else having this problem, simply do this in your
build.gradle
:Seems to work for me!
Ok I fixed the last error by deleting the virtual device and creating a new one. Now I choose nexus 6 and now it works. Note that it can take up to a minute until the emulator is launched properly.
Summary for later visitors
sudo lsof -i :8081
andsudo kill -9 <pid>