I am unable to solve this issue for 3 days. The same source runs fine in iOS App (Mac System ofcourse). But gets this error when I try to run in Android emulator
I have tried most of the solutions available in the internet.
1 - Dev Settings -> Adding the local ip
2 - Cleaned npm (removed node_modules and installed npm again)
3 - uninstalled npm globally and reinstalled
4 - That useless adb commands also tried
When I run, npm run start
When go to my local ip (192.168.1.61:8081) in browser, i get to know React Package manager is not running.
Turn ON the mobile data on your android emulator. This might solve the issue.
Related
Why does the neither hot nor live reloading take any effect on this React Native app?
Abstract
I've recently started working as a contractor on developing a rather seasoned React/React Native app (logic is being shared for both mobile version of the website and native application) for a company which does not rely on expo. Having always worked with the mentioned tool, the transition to in-house methods of dealing with React Native gives me some headache.
Setting the emulator to settings that used to work for me (having manually turned on hot reloading on emulator is the closest I get to expo) do not affect the app in any way other than sending a notification that hot reload took place.
Moreover, I assume that the issue might be platform-specific. The lead front end dev works on Windows with the same project/dev environment setup and experiences no trouble.
On starting the app
To launch the app, I'm using custom npm run android script (depending on gulp), which goes as follows:
npm run android
npm run buildRN && npm run rnAndroid
buildRN: npm run dropOldBabel && npm run buildNF && npm run rnLink && npm run buildImagesList
dropOldBabel: cd node_modules && rm -f react-pure-render/.babelrc redux-devtools-themes/.babelrc base16/.babelrc react-json-tree/.babelrc form-schema-validation/.babelrc && cd ..
buildNF: gulp buildNativeFiles
rnLink: node node_modules/react-native/local-cli/cli.js link
buildImagesList: gulp generateImagesList
rnAndroid: node node_modules/react-native/local-cli/cli.js run-android
After going through generating images, it starts the JS server, fires up Gradle and installs the app on target device (my Android emulator).
App targets running on localhost on port 8081, therefore adb -s emulator-5554 reverse tcp:8081 tcp:8081 command is being issued. I suspect that this port forwarding might somehow be the one to blame for the issue, although I don't know how to back this claim up.
Then the app starts with adb -s emulator-5554 shell am start -n com.firm.name/com.firm.name.MainActivity command and node console happily shows Starting: Intent { cmp=com.firm.name/.MainActivity }.
On the development process
As experience with expo taught me, it shall be enough to make changes and save the file for the change to take effect. However, this is not the case.
Saving a file does nothing except informing me via emulator that hot reloading took place. Beside this toast notification I get nothing.
Moreover, turning on Live Reload changes nothing; the change is applied iff I restart the app completely by stopping the server and invoking npm run android.
Platform
OS
elementary OS 6 Odin (Built on Ubuntu 20.04.2 LTS)
Node
npm -v 6.4.1
node -v 10.14.1
React Native
react-native-cli: 2.0.1
react-native: 0.59.10
Android Emulator
Android emulator version 30.8.4.0 (build_id 7600983)
Nexus 5X image
Summary
To sum it up - what could possibly cause such behavior?
Why does the code not change until restart while the emulator clearly notices the change?
Why does it only happen on my platform, not on Windows 10?
I'm having issues to run my react native apps in physical devices. When I execute react-native run-android using a Genymotion virtual device for example, it works perfectly.
But when I try to execute in physical connected devices, i get multiple errors.
I tried 2 different devices, and checked with "adb devices" if they are connected, they do.
When I try to just execute "react-native run-android", I get the following error: (and nothing appears on physical device)
But when I check for devices, and use the device id when executing like:
"react-native run-android --deviceId E6D68T7P99999999", I get the new error: (but now appearing "Unable to load script from assets 'Index.android.bundle'." on the device)
Also I have tried some other ways
In my project folder android/app/build.gradle, I changed where it was
compile "com.facebook.react:react-native:+"
to
compile "com.facebook.react:react-native:0.44.0"
This makes to BUILD appears SUCESSFULL, but otherwise, in the physical device appears like:
"The development server returned response error code: 404
URL: etc etc.
BODY: Cannot GET /index.android.delta?platform=android&dev=true&minify=false"
Can anyone help me please? I tried all the ways, using react-native start, killing process on port 8081 but NOTHING works with me!
React Native version: 0.44.0,
Windows 7 x64,
Tried on 2 different devices and
Developer mode and usb debugging mode ON
Try using adb install -r to reinstall your apk. I notice that your error says the apk already exists.
Failure [INSTALL_FAILED_ALREADY_EXISTS] when I tried to update my application
I had the same problem today and I do not know whether you have solved your problem, but for me, I had to add "ANDROID_HOME" environment variable(specify the SDK path). I hope it helps anyone who might come in contact with such problem
There's actually a hand full of things you could try to fix this problem.
1) npm install
2) npm start -- --reset-cache
3) Delete node_modules then npm install
4)cd to android and gradlew clean
5) Make sure all of your Java SDKs or what not are in the correct system path.
6) Restart your computer then try again.
Let me know your progress once you tried these options!
I got an issue on meteor JS on my windows 10, I have installed android studio and Java 8 JDK. On my meteor project I tried to build an android by typing meteor install-sdk android, but I got an error of This command is not yet available on Windows. .. Does anyone have an idea about this?
I know this was posted a year ago, but I found a fix recently, just in case anybody gets stuck on this and needs help.
It's from this link: https://github.com/meteor/meteor/issues/4155#issuecomment-384105563
But I'll repost the solution with a few extra changes I had to make by myself.
Basically you need to install Android studio and run it to get the Android SDK, install the Java JDK, and install Cordova. After this you can add the android platform to meteor.
Steps:
Install Android Studio
Run Android Studio once for download, full installation, and accept terms
Update npm with npm i npm
Run npm install cordova -g (-g flag for global install)
Run meteor npm i -g write-file-atomic path-is-inside async-some dezalgo
Run meteor add-platform android
After doing this, you should be able to run meteor run android-device to run on your Android device using a USB cable.
NOTE:
If you are connected to a WiFi network while running meteor run android-device, you might get an error similar to this:
Error detecting IP address for mobile app to connect to:
Found multiple network interfaces with non-internal IPv4 addresses:
'some IP address', 'some IP address'
Please specify the address that the mobile app should connect
to with --mobile-server.
To fix this, modify the command to:
meteor run android-device --mobile-server <ip.of.my.device>
Of course, ensure your PC and Android device are on the same WiFi network.
Go to Settings>About Device>Status to get your current IP Address on your Android device.
The app will now be installed on your phone over the WiFi connection.
(It might take a while though)
Hope this helps.
Cheers.
I have installed the development environment for react native on Windows 7 using the instructions here.
I have installed the following packages:
Python 2.7
node 4.2.4
npm 2.14.12
react-native-cli 0.1.10
react-native 0.18.0-rc
Android SDK
I can generate a skeleton project using the command react-native init Test.
However, when I execute the command react-native run-android, the following error occurs: Unable to install path\to\app-debug.apk.
The device, a Samsung Galuxy running Android 5.0.1, is connected to my PC and USB debugging on the phone has been enabled. When I type adb devices the phone appears in the list.
I can download the apk to the phone manually using the command adb install. However, when I run the app, a red screen appears with the error "Unable to download js bundle." This error persists even after I do the following:
Start the local development server using react-native start
Executing the command: adb reverse tcp:8081 tcp:8081
On the phone, setting the debug server host and port to localhost:8081
Update: I have solved one problem by downloading gradle to version 1.2.3 as described here. However, the red screen still appears with the error Unable to download js bundle.
What could be the problem?
You are working fine. for this problem have added the IP address in device Setting server host. one more thing your machine and device should have on same network.
I downloaded the examples from simpligility.github.io/android-maven-plugin and did a mvn clean package android:deploy on the helloflashlight example.
After setting adbConnectionTimeout to 15000 everything went fine for one run. I deployed the app sucessfully - the app started on my device and I was able to push the color buttons.
After that I ran mvn android:undeploy to clean the device. Now I am not able to deploy this test app again. Maven says FAILURE "E/Device: Error during Sync: Eine vorhandene Verbindung wurde vom Remotehost geschlossen" Which means an open connection was closed by remote host(?).
I googled and found out that the problem may be 2 processes of adb.exe starting during deploy. So I entered adb kill-server and shut the adb down.
Still on each deploy 2 adb.exe are starting, one is shutting down immediatly, the other stays open. Searching for adb.exe at my computer only finds one adb.exe.
Does anybody have some hints for me?
My system setup:
I installed Eclipse with current ADT (Android Deploment Tools).
I used the Android SDK Manager to download and install android sdk and tools into C:\users\me\android-sdk. I added a samsung device to the device list which is displayed when I enter adb devices
After that I configured Maven for android - setting ANDROID_HOME and added %ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools to my PATH.
I am working with Windows 7 64-bit.
It seemed to be a problem with the device. I switch to another device of same type... no problems any more.