I installed android studio, I configured the environment variables and everything, I installed genymotion and created a device, but running the react-native run-android in the project folder occurs the following error:
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.
please help me in this problem. React-native does not find Genymotion disositivo, in this link has more details: https://pt.stackoverflow.com/questions/382115/react-native-n%C3%A3o-reconhece-genymotion
It tries to connect the emulator to the ADB, by the IP of the device. To check the IP of the device, simply click on an emulator window, the IP address is in the title of the window.
No terminal will run the command:
$ adb connect ip_of_your_emulator:5555
Soon after, run:
$ adb devices
If the name of your file appears in the list, your emulator has been connected successfully!
With the emulator open, simply run the native run-android in the folder of your project.
I've had the same problem earlier this month. As far as I can tell the newer versions of Genymotion don't register on adb devices, a user in the Expo forums speculates it's because they have a paywall now.
I recommend switching to Android Studio, that's what I did to solve my problem.
I ran react-native with the --verbose flag, and got the following error:
...
error Failed to install the app. Make sure you have the Android development
environment set up: https://reactnative.dev/docs/environment-setup.
Error: spawn ./gradlew EACCES
...
So, I gave permissions to the android/gradlew folder as follows:
chmod 755 android/gradlew
But then, I got an error regarding Google Play Licenses:
error Failed to install the app. Please accept all necessary Android SDK
licenses using Android SDK Manager: "$ANDROID_HOME/tools/bin/sdkmanager --licenses".
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
So yeah, pretty the solution was:
Downloading Android Studio with its own SDK
Change the env variabe ANDROID_HOME to the one installed with Android Studio
Installing Google Play Licensing Library (In Android Studio, go to Settings>SDK Manager>SDK Tools, select Google Play License Library and then install)
Related
I have that weird error when running "npx react-native run-android" that is only occuring in a specific react native project only on my Macbook with android simulator. Other RN apps are running fine on my mac with android.
On a windows pc this specific RN app is also working fine.
Error: spawn Unknown system error -8
at ChildProcess.spawn (node:internal/child_process:413:11)
at Object.spawn (node:child_process:743:9)
at module.exports (/Users/hannes/Projects/test2/mapp/native-frame/node_modules/#react-native-community/cli-platform-android/node_modules/execa/index.js:205:26)
I tried the following things:
deleting package-lock.json
rm -r node_modules + gradlew clean (in android folder)
creating a new virtual device in android studio with API level according to build.gradle
upgrading node to 18.8.0
upgrading npm to 8.18.0
npm cache clean –force
Somebody any ideas?
After using "run-ios" in the meantime I had to face the problem again and found a solution.
npx react-native run-android
this line is using the port 8081 and my macbook did sometimes use this port for another service
lsof -i tcp:8081
this command showed the process that was running
COMMAND PID FD DEVICE SIZE/OFF NODE NAME
node 44492 24u 0t0 TCP *:sunproxyadmin (LISTEN)
I terminated this process but still got the error message.
So I called the gradle command for building and installing the app myself.
cd android && ./gradlew app:installDebug -PreactNativeDevServerPort=8081
This worked, the app got build and installed on my android device but I got multiple error messages in the android studio run console starting with:
Could not find generated setter for class
this error was also addressed on GitHub and Stackoverflow
So building and installing the app in production mode solved the problem for me.
./gradlew app:installRelease
I'm trying to run our react native app in Android emulator, after yarn android the Emulator starts but the app doesn't and after a few seconds I get the following error:
yarn run v1.22.10
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1755 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Launching emulator...
error Failed to launch emulator. Reason: Could not start emulator within 30 seconds..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
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: spawn ./gradlew EACCES
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The project runs perfectly in XCode (ios), also in my colleague's laptop (with Windows).
I'm using a Macbook Air m1, macOS 11.3.1, SDK Platform: Android S, Android Studio 4.2.2, yarn version v1.22.10, node v15.12.0,
Here might be a react-native configuration issue with the current development environment on your system.
Please have a close look at the official docs to set up the environment.
React native Docs
First of all, make sure you have your Android Environment setup correctly.
To verify run
echo $ANDROID_HOME
echo $PATH
and make sure both have the correct path to your Android SDK.
If it's not correct, you have to set up your Android Environment
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
Reference react-native-official-setup-guide
Other than that, the major issue which I see is related to Macbook Air M1, I just face a similar issue, M1 doesn't support VT-X.
To make sure that, your Macbook Air M1 supports VT-X open Android Studio and then AVD Manager.
Example (My Macbook) (Marked in PURPLE Box, VT-X is not supported)
Solution to this:
Download new emulator from android-emulator-apple-silicon-preview
This should enable developers to test/run ARM64 apps via ARM64 hardware virtualization.
For the "Error: spawn ./gradlew EACCES at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)".
Please try to input:
chmod 755 android/gradlew
in the root directory of the project. Then:
npx react-native run-android
I'm trying to get a brand new set up in place to run the example Ionic 4 app on an android device. I'm running on a brand new iMac and have installed all the needed prerequisites (ionic cli, npm, JDK8, Gradle, Android SDK, set up environmental variables, etc.) All latest version, fresh install.
I'm able to create the example app, add android platform, and build fine. But when I try to run to a device I get this error:
cordova build android
native-run android --app platforms/android/app/build/outputs/apk/debug/app-debug.apk --forward 8100:8100
[native-run] Error: spawn /Users/mike/Library/Android/sdk/platform-tools/adb ENOENT
[native-run] at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
[native-run] at onErrorNT (internal/child_process.js:469:16)
[native-run] at processTicksAndRejections (internal/process/task_queues.js:84:21)
[ERROR] An error occurred while running subprocess native-run.
What concerns me is the file path shown (.../sdk/platform-tools/adb) is different from where I see the location when navigating there myself (i.e. the fresh install of Android Studio has this at the location .../sdk/platform-tools/platform-tools/adb .... (note the extra "platform-tools" folder.
When I run "adb devices" it works, but only when I have the environmental variable (PATH) set to .../platform-tools/platform-tools/adb but when I try the ionic run command its obviously trying the other location. How? Why? What did I install wrong???
After much toiling... final step was to completely uninstall and remove all components of Android Studio, then reinstall again. This solved it and removed the duplicate folders. No idea how it would have happened on a standard install but if anyone else experiences it, this would be my recommendation.
I get a react native configuration error when I run react-native run-android. The command gives this error message:
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Error: Could not find or load main class JAVA_OPTS=-Xms256M
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
I can not solve this. I installed all the dependencies. My emulator is also running but the application does not start.
try set up your Android development environment. config environment variable(like path), sure your android sdk tools (like adb) be find on runtime!
When I go to install the packages from with Android Studio I get a "ADB not responding" error with wait/restart/close options.
I can run adb from a term. I can see my device and install the apk from the cmd line, but it doesn't work from within Android Studio.
In the terminal (that is running Android Studio) I get the following
03:56:36 E/adb: Unexpected exception 'Cannot run program "/media/5b317046-147a-42ee-aec1-f73caf1922c5/home/kloud9/WorkSpace/downloads/workspace/android-studio/sdk/platform-tools/adb": error=13, Permission denied' while attempting to get adb version from '/media/5b317046-147a-42ee-aec1-f73caf1922c5/home/kloud9/WorkSpace/downloads/workspace/android-studio/sdk/platform-tools/adb'
I have tried running Android Studio as sudo, but that doesn't help. I have all the environment variables set correctly, I am running oracle sun java jdk1.7.0. Any thoughts on what to try next?
Thanks,
Joe
I had the same issue. This fixed it for me.
sudo apt-get install ia32-libs