I have installed new application from git but i'm having this red screen error can some one help me out.
ReferenceError: Can't find variable: process (http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:2506)
E/unknown:React( 2312):
E/unknown:React( 2312): Try the following to fix the issue: E/unknown:React( 2312): • Ensure that the packager server is running E/unknown:React( 2312): • Ensure that your device/emulator is connected to your machine and has USB debugging enabled - run 'adb devices' to see a list of connected devices
E/unknown:React( 2312): • Ensure Airplane Mode is disabled E/unknown:React( 2312): • If you're on a physical device connected to the same machine, run 'adb reverse tcp:8081 tcp:8081' to forward requests from your device
E/unknown:React( 2312): • If your device is on the same Wi-Fi network, set 'Debug server host & port for device' in 'Dev settings' to your machine's IP address and the port of the local dev server - e.g. 10.0.1.1:8081
this output is adb logcat.
I have created the github issue any one can refer isssue
Did you run adb reverse tcp:8081 tcp:8081 as suggested in the error message? You always need to execute this after connecting a physical device, and you might need to do the same for Genymotion (never used it with React).
Also make sure that you have no other process running on port 8081: sudo lsof -n -i4TCP:8081 | grep LISTEN.
If you do, you can either kill that process by executing kill -9 <PID>, or start packager on another port: react-native start --port 8082.
If this doesn't help try to open the app on a basic Android emulator instead of Genymotion to see if you get the same error or not.
My problem is mismatch of the native-base module in react-native when i upgraded. checkout this issue and also do npm clean cache.
I also deleted node_module and reinstalled.
I went with native-base": "0.5.15" react-native : "0.33.1" and react is "15.3.1" and everything started working fine.
check this also facebook troubleshoot
Related
I have a flutter app that I debug on real device, and it runs fine in the debug mode.
I got to a point when I created a backend server that runs in a localhost:8080 only machine, so in order to make it accessible from my real phone device also, I ran:
adb reverse tcp:8080 tcp:8080
and it worked exactly as I expected where the app was running.
But, after this, if I re-rerun the app again in the real device ( unplug and plug again the USB in the machine ), it got to the point of showing the √ Built build\app\outputs\flutter-apk\app-debug.apk. and this error got thrown and it terminate/close the debug process of the app :
Error connecting to the service protocol: failed to connect to http://127.0.0.1:61410/DHX5GEb2kn4=/
I did try to kill the adb.exe command with:
adb kill-server
supposing that this will undo the adb reverse command but the same error gets thrown
well, I found a painful fix, which is restarting the device, but this takes much time and is painful.
I want to know what should I turn on/off while debugging my flutter app
I finally managed to fic the issue, and get my app debugging properly again.
What I did wrong ?
When I needed the adb, I thought it's not installed on my laptop since when I runned adb command in command line tool (cmd), it tells me that it's not recognized, so the smart me did downloaded the android platforms-tools separatly from Here
, and I runned the :
adb reverse tcp:8080 tcp:8080
from it's folder, which runned, and I thought I solved the issue, but what I just learned is that the Dart VM server uses an internal installed another adb.exe which have a different version (39) that what I run the command with (41).
so when I re-debug the flutter project, the error happens.
How did I fix it?
I did simply searched for the internal adb.exe, you can find in the Android folder, ...\Android\SDK\platforms\tools\adb.exe.
I Paste the new adb.exe with the height version inside the folder.
Run the command from that folder
For 3., you can set the path of that folder in the PATH in environment variables, so you can run the adb commands from anywhere.
Since Xcode and Android studio consume a lot, I am having storage and processing capacity issues on my Mac, while developing React Native Applications.
My Question is that is there any way to run emulators (in my case android emulator) on another PC, while I am coding on Mac?
Thank you
I tried once the solution below, it might also work for you. And the source is in this repo.
If you want to write and compile an Android application on one machine and debug it remotely on the emulator launched on another follow the instructions below:
Preparation
First of all you need to install SSH server on your remote machine.
Ubuntu
You can use OpenSSH.
sudo apt install openssh-server
Windows
You can install OpenSSH on Windows following this link.
Connection
Now you must connect local machine to remote server using SSH tunnel.
The emulator listens on two TCP ports per instance: 5554 for the telnet interface and 5555 for control communication with tools like DDMS. So you could probably get away with only forwarding port 5555. Each subsequent emulator takes the next available even+odd port number tuple.
Note that you need to enter the ip address of emulator running on remote server instead of emulator-ip and also remote machine username and hostname instead of myuser and remote-server.
Ubuntu
On the local machine try:
ssh -NL 5554:emulator-ip:5554 -L 5555:emulator-ip:5555 myuser#remote-server
Windows
Follow this link instructions and add two source ports and destinations below:
Source port: 5554
Destination: emulator-ip:5554
Source port: 5555
Destination: emulator-ip:5555
then connect to remote server.
ADB
The emulator tries to notify a local adb server at startup; hence you need to restart adb in order for it to probe the local 5554+ ports.
adb kill-server; adb devices
adb devices shows a new emulator — emulator-5554 — and you can use it as if it is running on your local machine.
Running
Finally run:
react-native run-android
the app should be installed on emulator, but you may face an error:
error: more than one device/emulator
Could not run adb reverse: Command failed: path/to/sdk/adb -s emulator-5554 reverse tcp:8081 tcp:8081
you need to specify your debug host IP and port in app's Developer menu -> Dev settings -> Debug server host & port, that is your local machine ip address and 8081 for port.
Note that after APK installation you don't need to do any of these steps. You can just start the npm server: npm start in the project directory of your local machine, run the app on the emulator in remote machine and then reload.
if there was another error:
Exception in thread "Device List Monitor" java.lang.NullPointerException
try:
react-native run-android --deviceId
I am trying to get React Native running on Ubuntu 16.04. I have used it with create-react-native-app and expo on my Windows machine with both the Android Studio virtual device and a tablet connected by USB. Now I have a new Ubuntu laptop and a Ubuntu dual boot on my PC and am trying to set it up there but have failed miserably.
Let's deal with the laptop. Following the instructions, I have installed Expo and Genymotion. Expo could never work right so now I'm just trying to get it going more directly. I have also installed Java 8 and watchman. I've installed and tried too many things to mention. I've put in about 20 hours so far.
Here is what happens when I try to start things.
If I plug in my tablet, I get:
kevin#kevin-Kudu:~/programming/rn4$ adb devices
adb server is out of date. killing...
* daemon started successfully *
List of devices attached
5205132d4f9011af device
(As a side note, it seems that my adb server is always out of date.) When I try to run the default code installed by react-native-cli by running react-native run-android, I get:
kevin#kevin-Kudu:~/programming/rn4$ react-native run-android
Scanning folders for symlinks in /home/kevin/programming/rn4/node_modules (9ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
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've researched these errors and can't find a solution that works.
If I start an Android Studio virtual device (N6, API 23), it starts up. adb devices gets me:
kevin#kevin-Kudu:~/programming/rn4$ adb devices
adb server is out of date. killing...
* daemon started successfully *
List of devices attached
5205132d4f9011af device
When I try to run the app:
kevin#kevin-Kudu:~/programming/rn4$ react-native run-android
Scanning folders for symlinks in /home/kevin/programming/rn4/node_modules (9ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
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
Again, I haven't been apple to find a solution.
When I try to do the same thing through genymotion and do adb devices, I get:
kevin#kevin-Kudu:~/programming/rn4$ adb devices
adb server is out of date. killing...
cannot bind 'tcp:5037'
ADB server didn't ACK
* failed to start daemon *
error:
I get the same result when I try to run the app.
Any ideas what I should try next? Please bear in mind that I am still fairly new to linux so please be specific. If you tell me, "Simply change the RX74 constant in the Fetzer config file" I'm not going to have any idea what you are talking about. (I've had bad experiences with linux advice that assumes that I know what every file on the system is and where to find it.)
Thanx in advance.
ADDENDUM 1 #Vigas Deep:
When I check which -a adb:
kevin#kevin-Kudu:~$ which -a adb
/usr/bin/adb
/usr/bin/adb
/home/kevin/Android/Sdk/platform-tools/adb
So I have more than one. I'll figure out why one is getting called twice, for now I just rename it, and now I get:
kevin#kevin-Kudu:~$ which -a adb
/home/kevin/Android/Sdk/platform-tools/adb
I fire up the Android Studio virtual device and check it:
kevin#kevin-Kudu:~$ adb devices
List of devices attached
emulator-5554 device
And when I try to run a RN starter app:
kevin#kevin-Kudu:~/programming/rn4$ react-native run-android
Scanning folders for symlinks in /home/kevin/programming/rn4/node_modules (18ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
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
Interestingly, when I try to restart the adb server, I get:
kevin#kevin-Kudu:~/programming/rn4$ sudo adb kill-server && adb start-server
[sudo] password for kevin:
sudo: adb: command not found
Does the adb in the SDK not have those commands?
Just for kicks, I reboot and try pluggin in a tablet:
kevin#kevin-Kudu:~$ adb devices
List of devices attached
5205132d4f9011af device
(But for some reason only shows up when plugged into the USB2 port, very inconveniently located.)
When I try to run the RN project:
kevin#kevin-Kudu:~/programming/rn4$ react-native run-android
Scanning folders for symlinks in /home/kevin/programming/rn4/node_modules (21ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
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
Sorry, that's all the testing I can do for now. Any other ideas?
ADDENDUM 2 #Vigas Deep:
"just to make sure that its using the adb located inside sdk; use this command for now: /home/kevin/Android/Sdk/platform-tools/adb devices"
OK, I get the same result whichever I use.
"and do not use sudo for adb command because we are not going to run react-native run-android as sudo."
OK. All the examples I saw used sudo to start and kill the adb server. Strangely, now it works without sudo but not with. Before, I think it was the opposite, but I haven't tried it without in a long time so I can't be sure.
"Also; are you using openJDK or oracleJDK ; how did you install the JDK?"
I thought I remembered going to the Oracle site, but when I do "java -version", I get:
kevin#kevin-Kudu:~/programming/rn4$ java -version
java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-3)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
This would seem to indicate otherwise. Should I change it?
ADDENDUM 3 #Vigas Deep:
OK, I looked up how to remove openjdk and followed it. I found instructions about how to install the jdk8, just to be sure. I am getting the same error when I try to run the RN app. When I check java -version:
kevin#kevin-Kudu:~/programming/rn4$ java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
and
kevin#kevin-Kudu:~/programming/rn4$ readlink -f $(which java)
/usr/lib/jvm/java-8-oracle/jre/bin/java
When I check the jvm folder:
kevin#kevin-Kudu:/usr/lib/jvm$ ls
java-8-oracle
Just in case, here is my current $PATH:
kevin#kevin-Kudu:/usr/lib/jvm$ echo -e ${PATH//:/\\n}
/home/kevin/bin
/home/kevin/.local/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
/home/kevin/bin
/usr/bin
/snap/bin
/usr/lib/jvm/java-8-oracle/bin
/usr/lib/jvm/java-8-oracle/db/bin
/usr/lib/jvm/java-8-oracle/jre/bin
/home/kevin/Android/Sdk/tools
/home/kevin/Android/Sdk/platform-tools
Any other ideas? Am I missing something? (highly likely)
ADDENDUM 4 #Vigas Deep:
OK, so completely removed Java, mainly following this.
I reinstalled it using this.
After some monkeying around with genymotion, I was able to get an app started on create-react-native-app that ran on genymotion.
Thank you #vigas-deep. If you're even in Oakland, I owe you a beer, or whatever your beverage of choice is. Thanx!
I have eight years of experience with Ubuntu and other Linux based OSes.
I think the problem is you are having multiple versions of ADB.
run the following command to know if that's right.
which -a adb
And if you have multiple versions of adb, just keep the adb version which is inside your android sdk and remove/rename others.
prefer rename just incase if you need those executables again.
I'd be happy to help more if needed.
I don't modify any part of app; I just exec following cmds on macOS:
react-native init ***
cd ***
react-native run-android
I tested on both emulator and Samsung Galaxy note 3 both are the same.
also tried adb reverse.
My $PATH is
/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/mohammad/Documents/sdk/platform-tools/:/Users/mohammad/Documents/sdk
Then I get these errors in app (as in image):
ReferenceError: Can't find variable: require (http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:15)
Try the following to fix the issue:
• Ensure that the packager server is running
• Ensure that your device/emulator is connected to your machine and has USB debugging enabled - run 'adb devices' to see a list of connected devices
• Ensure Airplane Mode is disabled
• If you're on a physical device connected to the same machine, run 'adb reverse tcp:8081 tcp:8081' to forward requests from your device
• If your device is on the same Wi-Fi network, set 'Debug server host & port for device' in 'Dev settings' to your machine's IP address and the port of the local dev server - e.g. 10.0.1.1:8081
loadScript
JSBundleLoader.java:66
runJSBundle
CatalystInstanceImpl.java:177
call
XReactInstanceManagerImpl.java:906
call
XReactInstanceManagerImpl.java:899
run
MessageQueueThreadImpl.java:74
handleCallback
Handler.java:739
dispatchMessage
Handler.java:95
dispatchMessage
MessageQueueThreadHandler.java:31
loop
Looper.java:135
run
MessageQueueThreadImpl.java:196
run
Thread.java:818
The problem is cannot connect the packager server of react native and device (or) simulator.
To solve this problem, need to connect the packager server and device (or) simulator.
react native is default use adb reverse tcp:8081 tcp:8081 to connect the packager server and device (or) simulator.There has a some problem in under android 5.0 because adb reverse is not support under android 5.0. However, react native is also support with using same wi-fi network.
To Solve
android 5.0 (or) Above
Need to check the packager server is running or not. ( Some OS not run automatically like ubuntu, but you can run react-native start in your project directory. )
Need to connect device (or) simulator. ( If your using devices, need to connect your device and computer, and sure to open USB debugging mode. If your using simulator, sure to open simulator. ), ( You can check is step complete or not using adb devices command )
Run again react-native run-android (or) open dev menu of react native and press Reload.
below android 5.0
Need to check the packager server is running or not. ( Some OS not run automatically like ubuntu, but you can run react-native start in your project directory. )
Need to connect your device and computer on same wi-fi network. And add packager server IP on your device's dev menu > Dev Settings > Debug server host & port for device like xxx.xxx.xxx.xxx:port)
Run again react-native run-android (or) open dev menu of react native and press Reload.
Open Dev Menu
Devices
Press Menu button (or) shake device.
Simulator
Press Ctrl + M (or) Cmd + M.
Find Packager Server Host
Computer's IP. ( On unix use ifconfig in terminal (or) On Window use ipconfig. )
Port ( Can find on Packager Server Terminal like localhost:8081 )
I am trying to reverse-forward port through ADB, but it just returns cryptic error of error: closed. Normal forwarding works. Session snippet:
$ adb forward tcp:59778 tcp:59778
$ adb forward --list
015d2109ce0c1a0f tcp:59778 tcp:59778
$ adb forward --remove-all
$ adb forward --list
$ adb reverse --list
error: closed
error: closed
$ adb reverse tcp:59778 tcp:59778
error: closed
error: closed
I am connecting via USB to non-rooted Nexus 7 2012 Android 4.4.4 from Windows 7 Pro x64 on Boot Camp.
adb reverse was introduced in Android 5.0
Since adb reverse is not supported in Android versions lower than 5.0, you need to use an alternative method, for example connecting via Wi-Fi instead. If you are using React Native, Facebook has added official documentation to connect to the development server via Wi-Fi. Quoting the instructions for MacOS, but they also have them for Linux and Windows:
Method 2: Connect via Wi-Fi
You can also connect to the development server over Wi-Fi. You'll first need to install the app on your device using a USB cable, but once that has been done you can debug wirelessly by following these instructions. You'll need your development machine's current IP address before proceeding.
You can find the IP address in System Preferences → Network.
Make sure your laptop and your phone are on the same Wi-Fi network.
Open your React Native app on your device.
You'll see a red screen with an error. This is OK. The following steps will fix that.
Open the in-app Developer menu.
Go to Dev Settings → Debug server host for device.
Type in your machine's IP address and the port of the local dev server (e.g. 10.0.1.1:8081).
Go back to the Developer menu and select Reload JS.
Follow these steps carefully.
Note: All commands need to run inside a project only.
Run this command first:
npm react-native start
Open another window in the same project and run:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
This will create index.android.bundle in the assets folder
Run:
npm react-native run-android
Now you can get apk in the build folder which will work fine.
adb reverse requires Android 5.0+. For devices previous to that, you'll need to use a workaround like so.
If you have busybox installed on your Android device (most Genymotion images do), you can emulate adb reverse using this incantation:
adb shell busybox nc -ll -p {guest port} -e busybox nc {host IP} {host port}
In this case, "guest" is the Android OS running in the emulator and "host" is the computer running the emulator.
cause of adb reverse isnt working on android prior 5 you could propably use adb forward with a service listening on android and tunneling other connections through this inbound connection. I am doing this mostly with ssh, but you would need an ssh server on android. you than can connect using ssh -R incommingreverseportonandroid:hostyouwanttoforwardto:portyouwanttoforwardto sshuseronandroid#localhost -p portyouhaveusedforadbforwaqrdtoaccessandroidssshserver
but i dont know how to enable an ssh server on android and maybe there is a better way cause ssh uses encryption which isnt needed over usb and using up cpu.
i am using this way with my server to share a service when i am forced behind a nat...
hope someone will find a way to bring this teoretical way into practical possibility
Just use 10.0.2.2 instead of localhost/127.0.0.1 for your hostname. It will directly try to connect to the port on the host machine (same affect as reverse).