Nox player isn't showing in android studio - android-studio

I have an AMD A10 processor that doesn't support VT-x. I installed Nox player and enabled USB debugging but still Android studio cannot find the emulator. Any helpful and clear steps to install USB driver adb(Android Debug Bridge)

Connect a NOX device to Android Studio: By Abhijeet Pal
On CMD:
Route: cd C:\Program Files (x86)\Nox\bin
Connection: nox_adb.exe connect 127.0.0.1:62001
Not Connecting Fix
You need to find the correct port and use it. I faced the same problem so here is what I did.
Kill the server:
nox_adb.exe kill-server
Now try to connect on any port number, say, 62001:
C:\Program Files (x86)\Nox\bin>nox_adb.exe connect 127.0.0.1:62001
daemon not running. starting it now on port 5037
daemon started successfully
unable to connect to 127.0.0.1:62001:62001
Now try to use port 5037 as mentioned in the output above:
C:\Program Files (x86)\Nox\bin>nox_adb.exe kill-server
C:\Program Files (x86)\Nox\bin>nox_adb.exe connect 127.0.0.1:5037
daemon not running. starting it now on port 5037
daemon started successfully
connected to 127.0.0.1:5037
It should work fine then.
127.0.0.1:5037 Disconnected on Android Studio Solution
It should appear without any further customizations. I have used Nox Emulator for a while and you have to do a little trick to make it work for debugging:
Click the debug or run button on Android Studio2. Wait for the popup to open (the one where it lists the connected devices)3. Run Nox Emulator4. After Nox is ready and running, it should appear on your connected devices list.
This isn't of my authorship, that's why I attached all sources of problems that I've faced.

I made the mistake of starting the adb server before and then opening android studio. It didn't work.
Subsequently did this:
D:\Program Files\Nox\bin>nox_adb.exe connect 127.0.0.1:62001
adb server version (41) doesn't match this client (36); killing...
* daemon started successfully *
connected to 127.0.0.1:62001
Android studio immediately updated and showed the following:

Related

Remote debugging nodejs app in Intellij with Docker - port already allocated

I want to start debugging node.js app using Intellij and node.js interpreter running on Docker. While running the app works, when I try to debug I get the error:
Error running 'index.js'
com.github.dockerjava.api.exception.InternalServerErrorException:
{"message":"driver failed programming external connectivity on
endpoint focused_poincare
(a17137973880d1be7c6a74fc142184fdda31e0dec8ebd539b09d9dbe4cf70014):
Error starting userland proxy: Bind for 0.0.0.0:55578 failed: port is
already allocated"}
Remote interpreter was configured acccording to the documentation. I have created a new Node.js Run/Debug configuration and entered the following data:
.
What might be the cause for debugging not working?
I use:
Intellij Idea Ultimate v. 2019.1.4 Preview
Intellij NodeJS plugin v. 191.7479.1, NodeJS remote interpreter plugin v. 191.6014.8 and Docker plugin v. 191.7141.44
Docker Desktop Community v. 2.0.0.3
EDIT: Adressing the comments:
Local debugging works. The file (index.js) that I am trying to run consists only of console.log('Hello world!') so I don't spawn any child processes on my own. My host system has Windows 10 Pro as OS, so for checking the open ports on host system I used netstat -an | find "55578", which returned nothing. Moreover, if I try to run docker manually from the command line, using docker run -it -p 55578:55578 node, everything runs and no error is given.
Also, each time I try remote debugging, the port number given by Intellij in an error message seems to be random high port number. I tried looking for open ports just after getting error message, but never found one that is open with a number reported by Intellij and those indeed appear in the output:
My Run/Debug configuration:
My Docker configuration (I had to check "Expose daemon on tcp://localhost:2375 without TLS" in Docker configuration to make Intellij and Docker play together):
EDIT: When I add --inspect-brk=0.0.0.0:55432 as "Node Parameters" in "Run/Debug Configurations" Intellij windows (per this bug report) the container nad program start, but debugging seems to be no-op (e.g. the program does not stop on breakpoints).
After updating to Intellij v. 2019.2 I was able to get the container debugging to work using the workaround already mentioned in my question.
I have added a parameter --inspect-brk=0.0.0.0:55432 to Node parameters option in Run/Debug configuration (see the picture below) and everything seems to be working, including the breakpoints.

The latest ndk-gdb can not connect to my device

I just get trouble to use ndk-gdb to debug my native application. This is my environment:
OS X El Captain 10.11.5
NDK version r12
SDK version 24
Build tool version 24.0.0
Device Nexus 6P with Android N (NPD35K)
The issue:
When I was going to launch ndk-gdb it always fail with the message
Error: unable to connect to device.
Remote connection closed
However, the gdbserver instance has already been launched since my app is paused and I could see the gdbserver in adb shell ps list.
What I have tried:
Instead of start gdbserver by the ndk-gdb script, I launched the
gdbserver manually by adb run-as and make sure the gdbserver
keeps running
Make a socket forward by adb forward :5039 localfilesystem:/the_gdb_socket_path
Use netstat -na | grep 5309 to make sure the port is being listening
Use telnet localhost 5039 to test socket but get the error Connection closed by foreign host
Is there any better way to identify where the issue cause the remote gdb failed on connection?
In my case, I had to root the phone to fix that connection issue, see:
Does ndk-gdb work under macOS Sierra?

How do I add -http-proxy to an android emulator launch from Android Studio 2.0

I have a local dev web server running on a machine sitting next to me.
I use a hosts file locally on my laptop to map an url to the machine and apparently the android emulator uses NAT and can't resolve the url.
I wanted to configure the emulator to use Charles Proxy for all Internet traffic so that it will go through my laptop and pick up my hosts file for name resolution.
The instructions here say I need to set -http-proxy.
How do I do that if I launch from Android Studio 2.0?
Run emulator from command line
emulator -avd <avd name> -http-proxy ip:port
emulator -avd Nexus_5_API_23 -http-proxy 127.0.0.1:8888
Windows
%UserProfile%\AppData\Local\Android\sdk\tools\emulator -avd Nexus_5_API_23 -http-proxy 127.0.0.1:8888
BTW
I wasn't able to make a proxy work for me.
There other alternatives The best way to review Android HTTP connections:
OKHtttp Logging Interceptor - logs in logcat, good for Retrofit
Flipper https://fbflipper.com/ - nice UI and modern multiplatform approach
Network Profiler - build into Android Studio, but I never made it work
Stetho http://facebook.github.io/stetho - allows to display all android device/emulator requests/responses in Google chrome developer tools (deprecated but still works well)
Open the Android emulator, go to mobile data settings, change the APN and insert there ip and port of your proxy.
From now on, all the data in/out of the emulator will go through your proxy.
I tried above steps but it was not coming. Finally the command prompt worked.
emulator -avd <avd name> -http-proxy http://CharlesIP address:8888/

cannot kill adb.exe manually

After android studio running several hrs,suddenly the connected device shows as offline.And what's annoying is that it always show an offline device no matter connecting or not by usb.
As what we always do, I try to call adb kill-server or adb start-server.From the process list, it shows an new adb.exe was created while the former one wont disappear even i try to stop it from the list.
So far my only solution is restart pc, i mean, FORCE restart.Normal stop or restart will keep my pc in the stopping screen.
Hope someone facing the same issues can support a better solution.Thanks anyway.
Try to update your Android Studio to 2.2. After that you will be able to kill adb.exe if you need.
That helped me fix that bug, but still facing it in 2.1.1.
This is how I deal with my case which happens periodically.
Per the tip of this answer, I find the processes using port 5037 wit command netstat as following:
Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\Hong>netstat -a -n -o | find "5037"
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 9232
TCP 127.0.0.1:5037 127.0.0.1:52034 ESTABLISHED 9232
TCP 127.0.0.1:52034 127.0.0.1:5037 ESTABLISHED 10824
In the above results, process 9232 is adb.exe and process 10824 is Visual Studio. I can kill adb.exe after closing the other process using port 5037 - Visual Studio

ReferenceError: Can't find variable: __fbBatchedBridge

Using just the default code from react-native init AwesomeProject, when I run the app I get the 'ReferenceError: Can't find variable: __fbBatchedBridge (line 1 in the generated bundle)'.
And, when I 'Reload JS', the app just has the white background rather than any 'hello world' views. I haven't touched any of the code from the init.
Any ideas how to resolve the error?
Screenshot (click to view full size):
Using:
Ubuntu 15.10, 64-bit
Node.js v5.3.0
reactive-native v0.1.7
Nexus 5X, API 6.0.1
I generally see this when the packager hasn't started. Ensure that is running by running react-native start
I had the same issue while using Visual Studio Android Emulator. When the red screen shows up type in the command line
adb shell input keyevent 82
This will trigger the shake event and launch the dev menu
Then hit Dev Settings > Debug server host & port for device and enter <your ip adress>:8081. If for some reason you cannot type in the field you can trigger the text action in the command line by using
adb shell input text <your ip adress>:8081
i solved it using this command
adb reverse tcp:8081 tcp:8081
Thank you rmevans9 and Anonsage for your answers!
I am using HTC One on Ubuntu and there is no menu option, anyway this is the summary of the answers that worked for me:
Create the project
$ react-native init MyProject
$ cd MyProject/
In first console tab run and leave it running as you develop (react-native start alternative):
$ npm start
In second console tab compile and install the project (connect the device to the USB if you want):
$ react-native run-android
Fix ReferenceError: Can't find variable: __fbBatchedBridge:
Find you local ip address by executing ifconfig on Linux/Mac, for example:
inet addr:192.168.0.3
Shake the device to see menu options while app is running (if you don't have "Menu" button)
Go to Dev Settings -> Debug server host & port for device in Debugging section and copy your local ip address with the specific port:
192.168.0.3:8081 (the port can be viewed when running npm start from the first tab)
then go/press Back
Shake the device to see menu options again and press Enable Live Reload (to see changes live when editing)
Shake the device to see menu options again and press Reload JS
This worked for me according to documentation
http://facebook.github.io/react-native/docs/running-on-device-android.html#content
Using adb reverse
Note that this option is available on devices running android 5.0+ (API 21).
Have your device connected via USB with debugging enabled (see paragraph above on how to enable USB debugging on your device).
Run adb reverse tcp:8081 tcp:8081
You can use Reload JS and other development options with no extra configuration
Then Run react-native run-android which will automatically start dev server on 8081 port on your dev machine if not already running.
I encountered this when I had specified different react native versions in my packages.json and my build.gradle file. Making sure they matched, running npm update, and rebuilding from android studio fixed the issue for me.
I had the same problem.
As I followed all the steps mentioned in other answers, I could not resolve the issue.
In my case the firewall was blocking the packets coming from android.
Also If you have submitted your app for the iTunes store, also make sure that your jsCodeLocation is back to the localhost, as shown bellow:
jsCodeLocation = [NSURL URLWithString:#"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
/**
* OPTION 2
* Load from pre-bundled file on disk. The static bundle is automatically
* generated by "Bundle React Native code and images" build step.
*/
//jsCodeLocation = [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"];

Resources