iam using genymotion emulator to run react native on mac,
react-native-cli: 2.0.1
react-native: 0.53.0
node:v8.9.4
while i running react-native run-android i got error like this
...
.....
Installing APK 'app-debug.apk' on 'GNexus5623 - 6.0' for app:debug
11:17:39 E/DeviceMonitor: Adb connection Error:EOF
11:17:39 E/DeviceMonitor: Connection attempts: 1
Installed on 1 device.
BUILD SUCCESSFUL
Total time: 14.691 secs
This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html
Starting the app (/Users/yan/Library/Android/sdk/platform-tools/adb shell am start -n com.vero/com.vero.MainActivity...
error: no devices/emulators found
does anyone give me solution, thanks
this worked for me (For debian based systems only), make sure you have configured genymotion to use your android Sdk by:
Open Genymotion
Click on the settings icon
go to ADB tab
Click on use Custom Sdk tools.
navigate to the folder you downloaded
and then add this to your .bashrc
export PATH=/home/{username}/Android/Sdk/tools:/home/{username}/Android/Sdk/platform-tools:$PATH
Related
I created a new react native app by using the expo cli.
iOS Xcode Emulator is working fine but getting below error for android emulator
Error: spawn adb ENOENT
I tried to uninstall and install back expo-cli. Tried to delete the emulator and create a new one. None of them is working.
I was in your same situation wherein I’d just installed expo and tried to run the app in an emulator on my Mac.
Apparently the problem was that ANDROID_HOME and adb weren’t set in my $PATH.
I solved it by referring to Option 3 (I already had android studio installed) of the top voted answer here.
In case you want to know what I did, I use ohmyzsh by default so I did the following:
nano .zshrc
Add these two lines in the .zshrc file.
export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Then run this in your terminal:
source ~/.zshrc
Restart your terminal and now everything works!
react-native run-android stuck 95% when Transforming artifact flipper-0.54.0.aar
According to your send picture , compile successfully done . but it's can't find Emulator to install app. first open Android studio and run Emulator in AVD manager . after your Emulator open run react-native run-android.
I solved this by downloading flipper-0.54.0.aar package manually
I created my app in react native using Expo but when i run the npm start command its showing me this:
running metro bundler on port 8081
and then
loading dependency graph, done
and never end. what to do?
Here is the complete console output.
First of all if you have a bundler like the one that you have used then it would suggest that you have used react-native init to create you application, instead of expo.
Expo bunders look like this:
If you have created a react-native init and as it suggests in your screenshot that you are building the app on a Windows machine, that means you will be developing on Android.
The instructions for using Android and running react-native are quite long and complicated, they can be found here. For the sake of brevity I am not going to repeat them here asyou can just follow this link. Make sure to choose Building Projects with Native Code -> Development OS: Windows -> Target OS: Android to find the instructions that are pertinent to your situation.
https://facebook.github.io/react-native/docs/getting-started.html
If you are planning on developing on an emulator then you will need to make sure that you have one installed (the link above has all the info that you need). Also you need to make sure that you launch your emulator before running react-native run-android if you do that then it should load on to the emulator and you should be able to see what you are developing on.
If you want to run on your own Android device then you should follow the instructions on this page https://facebook.github.io/react-native/docs/running-on-device (again choosing the options for your situation).
Expo
If this feels like too much effort, you can always try Expo. It doesn't require you to be able to deal with native code. And depending on your use case can be a better option than creating a project with react-native init, plus you can always eject from the expo project and turn it in to a full fledged react-native app.
You install the expo-cli with
npm install -g expo-cli
Then download the expo app from the App Store or the Google Play Store (depending on the mobile that you are using).
Then you can use
expo init
to create your application
Check out the expo documentation for more information https://docs.expo.io/versions/v32.0.0/workflow/up-and-running
Well, Nice question, First of all, I totally understand what's exactly your problem is, let me give you a solution in a very appropriate way.
Basically, there is two way to install and setup React Native Project on your mac and windows machines
1st React Native (native) Method: (That's basically you're using right know
Note: If you're using Apple product - Like MacBook then you can do IOS and Android both platform by using this method, if you're using Windows or Linux you can only do this part for Android platforms
In this method, we have to follow these simple steps
Download Nodejs from Offical website link here
Installing the React Native Cli
npm install -g react-native-cli
If you get an error like Cannot find module 'npmlog', try installing npm directly: curl -0 -L https://npmjs.org/install.sh | sudo sh.
(Only for mac)
Install the Xcode from Appstore (Only for Mac user/macos users)
otherwise
download and install the Android Studio (Stable version) from the official website of Android studio
Setup Xcode (Simulator) or Setup Android Studio for Android devices use (emulator)
by learn and guide from this link here
Note: Basically in your scenario, I'm pretty sure you didn't set up your emulator for android and simulator for IOS that's why you didn't see anything after
2nd React Native with Expo Method: that's you're not using a loading dependency graph
Use
For Android
react-native run-android
For IOS
react-native run-ios
2nd React Native without Expo (that's not your case):
In this method, we have to follow these simple steps
Download Nodejs from Offical website link here
installing expo cli
npm install -g expo-cli
expo init yourprojectname
cd yourprojectname
npm start
Note: Simulators and emulators way same for both
This is my first time setting up react native on Ubuntu 18.04 LTS. I have done the setup and I was trying to run the app on the device using the react-native run-android command.
Here is the output what I get in terminal,
ron#lenovo:~/react/app$ react-native run-android
Scanning folders for symlinks in /home/ron/react/app/node_modules (9ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Starting a Gradle Daemon, 1 busy Daemon could not be reused, use --status for details
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 /home/ron/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.
File /home/ron/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 26.0.3 in /home/ron/Android/Sdk/licenses
License for package Android SDK Build-Tools 26.0.3 accepted.
Preparing "Install Android SDK Build-Tools 26.0.3 (revision: 26.0.3)".
<=============> 100% CONFIGURING
> IDLE
It stays in this IDLE position forever. What is the fix or this issue?
The solution is to install Android SDK rev. 26.0.3. Your can install it from Android Studio's SDK Manager menu in File > Settings. Hope this helps.
I got the same error today. The solution is to create a file named local.properties and write in it this line:
sdk.dir=[the position of android sdk]
example:
sdk.dir=N\:\\Users\\andy\\AppData\\Local\\Android\\Sdk
you can get the sdk android via android studio: Android Studio - How to Change Android SDK Path
hope this will help you and other people out there who just begin learning react native.
I'm a newbie in React-native. In the first project. I init react project with command line react-native init <project name>
This environment:
nodejs: v4.5.0, npm: 4.1.2 and ANDROID_HOME.
When I run adb device
But when I run project react-native run-android
I try run command line adb reverse tcp:8081 tcp:8081 but it not working.
Who can tell me fix this error. Thanks
Install Android SDK v23 should resolve your problem.
Update answer:
Android API 23 I installed but when I install Android SDK Build-tool
23.0.1 it's working while Android SDK Build-tool 23.0.2 or 23.0.3 not working
Because 23.0.1 is the default SDK version for a React Native project. I don't know how to modify this but if you want to see the build version, checkout this file android/app/build.gradle. You would see a section with following content:
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
}
Did you enable developer options on your phone? if not check this line: enable developer options on android device
You need to install the Android build tools via Android Studio.
Open Android Studio
Go to Tools > Android > SDK Manager
Click "Launch Standalone SDK Manager" at the bottom of the window
Find the referenced package and check it (see below)
Click "Install packages..."
Agree to the licences
You should then be able to build onto the device.