I was watching a video where the instructor is using a console to type in commands that lead straight to the Emulated Android device. I have the emulated device functioning and I am using Android Studio, but I cannot seem to figure out where he starts the console from. Any ideas?
NOTE: The video is not public so I cannot link it.
I found a solution to my problem. TelNet needs to be enabled in Windows, before you can use it. It is disabled by default I believe. This site has step-by-step instructions for enabling it (it works for all versions of Windows - Vista - 7 - 8 - 8.1). Once TelNet CLIENT is enabled:
Go to -- C:\Program Files (x86)\Android\android-sdk\tools
SHIFT + RIGHT CLICK on an empty space
Click 'Open Command Window Here'
Type in 'telnet localhost 5554' (port of emulated device)
Now you should be connected to the Emulated Android device through TelNet.
On Windows 10
In Ask me anything type Cmd
Then Right mouse button on Command Prompt and Run as Administrator
Execute this command dism /online /Enable-Feature /FeatureName:TelnetClient you should get following:
Then type in following cd C:\Program Files (x86)\Android\android-sdk\tools
Then type in telnet localhost 5554 You should get this:
If not I have failed you....
Hope this saves you some time.
There is another way to do this, which might be a little quicker:
Enable telnet client on your computer
On Android Studio, click the Terminal tab located at the bottom of android studio
Type: 'telnet localhost 5554' and you should be connected
If you are windows user follow this step
go to control panel
go to programs and features
click on "turn windows feature on or off" a prompt box will be appear()
mark the checkbox of Telnet Client
open command prompt and type "telnet localhost port_number" (see cmd image) after this connection will be establish
try out various command like send sms port_number hello, geo fix 14 5 etc
Related
Followed the steps here to try react-native android on a windows box.
On a separate prompt I executed react-native start which is running fine
Started the AVD from AVD Manager
Executed react-native run-android
BUILD SUCCESSFUL
Total time: 27.632 secs
Starting the app on emulator-5554 (D:\software\Android\android-sdk/platform-tool
s/adb -s emulator-5554 shell am start -n com.awesomeproject/.MainActivity)...
Starting: Intent { cmp=com.awesomeproject/.MainActivity }
Executed react-native run-android on a separate console from within same folder
But I see an error which I'm having hard time to resolve. Please suggest resolution.
---EDIT---
Possibly the issue is that 8081 port is in use by McAfee. So I updated the server.js to run dev port on 8088 and now when I browse http://localhost:8088/index.android.bundle?platform=android I can see JS loading.
But how do I make android use this address instead of default **10.0.2.2:8081?** I found a file AndroidInfoHelpers.java which contains that 10.0.2.2 path but not sure if that's the way as being a JAVA file I possibly need to recompile whole program. There should be a simpler way to point android app to use a different port for dev server.
Also, when I execute react-native run-android the first line that gets output says "JS Server not recognized.. Continuing with the build" which likely is shouting the same thing.
A) Set the new port for dev server
User command
react-native start --port=8088
or yourproject\node_modules\react-native\local-cli\server\server.js
to set the the available port say 8080
now use react-native start to start server on 8080
B) Now to establish communication between emulator and dev server, use below command
adb -s emulator -5554 reverse tcp:8088 tcp:8088
i) 5554 =>emulator port (adb devices command will tell you emulator port but if this command is not working then set the path C:/../android-sdk/platform-tools in Path environemnt variable )
ii) 8088 =>server port
C) run the command react-native run-android
D) Follow below steps updating Dev server path in emulator
i) Ctrl + M for windows to open your dev menu for the emulator.
ii) Click Dev Settings
III) Under Debugging select Debug server host & port for device
IV) Enter the url and port for your application as 10.0.2.2:8088
Press cmd + M (Ctrl + M for windows) to open your dev menu for the emulator (Please make sure your react-native app is open in the active window of the android emulator before using this command)
Click Dev Settings
Under Debugging select Debug server host & port for device
Enter the correct url and port for your application in your case 10.0.2.2:8088
Once you do that you can reload your application and it should work.
1) First set the port number as 8088 in below file
yourproject\node_modules\react-native\local-cli\server\server.js
now build the project.
2) Follow below steps updating Dev server path in emulator
Ctrl + M for windows to open your dev menu for the emulator.
Click Dev Settings
Under Debugging select Debug server host & port for device
Enter the url and port for your application as 10.0.2.2:8088
This issue might occur because of the blockage of default port. In my case, I was able to fix it after executing following steps-
Start dev server on a new port:-
react-native start --port=8088
Open developer menu by vibrating on actual connected device or pressing 'Ctrl + M' on emulator.
Select Dev Settings
Under Debugging select Debug server host & port for device
Enter the url and port for your application as '10.0.2.2:8088'
Just run this one your phone, it is a waste of time to try to figure out the hard coded React code for the emulator. It just does not seem like enough time was spent fixing this issue. Spent 3 days on reading way to many blogs, and trying way to many things and nothing worked. Our company also runs McAfee and I had the same issue.
This worked for me. Does the same thing but quick.
Just set the port when run the app
react-native run-android --port=8082
appears after running react-native run-android
I click the reload JS button and it changes to
Which is more informative, I am using VS standalone Android Emulator, and have already ran adb reverse etc etc
I do not see an option for Debug server host & port for device in Dev settings like it says there should be.
This happens when you haven't set the server IP (which should be on the same local network as your phone).
From your question I assume you can connect to the emulator using adb then you should be able to send command to it using the following according to the official guide pointed out by G. Hamaide:
adb shell input keyevent 82
This should send open menu event to the emulator and show you the menu where you will find Dev Settings and if you open it there you will find Debug Server host & port.
In order to connect to this server you must be on the same local network (i.e. connected to the same router). I assume you are using default options on a Windows machine so open a cmd shell and learn you local IP address using ipconfig. You can now set host and port to YOUR_LOCAL_IP:8081 (default port is 8081). Try to reload and it should work now.
You need to follow the steps from their official guide.
From where you are stuck follow these steps :
Open the Developer menu by shaking the device or running adb shell input keyevent 82 from the command line.
Go to Dev Settings.
Go to 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). On Mac, you can find the IP address in System Preferences / Network. On Windows, open the command prompt and type ipconfig to find your machine's IP address (more info).
Go back to the Developer menu and select Reload JS.
I have read a few articles that BlueStacks App Player can be used to debug android apps via Eclipse, instead of the default android emulator.
Example article
But I think this refers to the Windows version, I was unable to get to it work on MacOS. Does anyone know how to debug using BlueStacks/eclipse on MAC?
adb connect localhost:10001
should do the trick.
Well, you can try another way:
1) First, open the DDMS via Window->Open Perspective->DDMS under Eclipse.
2) Then open BlueStacks App Player.(leave it opens)
3) After that switch back to Eclipse and you should notice there're two emulator under the Device tab.
Then click Reset adb under the small triangle at the Device tab.
After a few seconds, the another one emulator will disappear and you can proceed to the next step.
4) Then return back through Window->Open Perspective->Java under Eclipse.
5) Select your project and right click on it, choose Debug As->Debug Configurations
6) Under Android Application select your configuration or create a new one. On the Target tab choose Always prompt to pick deviceAfter this, select Apply then Debug.
7) Then select BlueStacks emulator in the prompt window, and finally select OK.
Alternatively, you can also open the BlueStacks App Player before Eclipse using the above steps(with minor changes).
For more info, visit the below links.(However, in Chinese...)
http://www.cnblogs.com/hbbbs/archive/2012/10/30/2746950.html
http://www.cnblogs.com/hbbbs/archive/2012/10/30/2746979.html
Hopefully this will help you.
C:\>cd Program Files (x86)\Android\android-sdk\platform-tools
C:\Program Files (x86)\Android\android-sdk\platform-tools>adb connect 127.0.0.1:5555
connected to 127.0.0.1:5555
C:\Program Files (x86)\Android\android-sdk\platform-tools>
Run Bluestacks.
open Command Prompt in Windows.
Go to Platform-tools using following command.
cd C:\Users\<username>\AppData\Local\Android\sdk\platform-tools
then write:
adb devices
With SDK tools 27 and later!
You get a list of devices detected by adb .. if BlueStacks-4 is installed you should see the device listed (emulator-555x).
For Mac users: localhost:5037 worked for me
BlueStacks bundles its own copy of adb, %PROGRAMFILES(x86)%\BlueStacks\HD-adb.exe. You can connect localhost with it, or any other command. BlueStacks 3 uses the default port 5555.
There are lots of times Eclipse can't connect to emulator that I turned on from AVD Manager, and just starts a new emulator by itself,( two emulators are the same ):((. How can I make eclipse find the emulator ?
some times restarting adb solves your problem
adb kill-server
adb start-server
for working easier in command line in windows, add the path of adb.exe to that Windows' path. For example add ";C:\Program Files\Android\android-sdk\platform-tools" to System Properties-> Advanced-> Environment Variables-> System Variables-> Path
One of the reasons of problems in device connection is a long USB cable or a two-piece cables like keyboard USB. try to connect your device to PC directly by a short cable.
I guess that you might suffer from the issue that the manually started emulator got disconnected somehow, shown with a message like
Error: emulator-5554 disconnected
in the Eclipse console view. There are several related questions and answers on stackoverflow like Why do I get a emulator-5554 disconnected message,
but for me none of those answers helped.
Whenever I see the error message for disconnection occur, I just shutdown that emulator and start it again. Normally that already "fixes" the problem, it just works on the next attempt (for me).
I was just experiencing this issue also. I agree with breceivemail, the ADB reconnected to the emulated device after reset, but there is a shortcut using Eclipse:
In the DDMS view => Devices window => View Menu (the down triangle in the header) => reset adb
You can choose the target device manually by changing the run configurations.
Run -> Run configurations -> choose your App -> Target tab -> select "Always promt to pick device"
If your device isn't available you will at least don't start a new Emulator.
If the emulator is still active, you can use adb to connect to it via tcp. In this way you can connect a disconnected emulator to your development system's loopback one port higher, just like if you are using emulator-5554, you can connect to it by using a higher port.
adb connect localhost:5555
There was been an issue with this technique, where the emulator control becomes inactive, and the developer cannot send GPS coordinates or SMSs or calls to emulator.
There is a one click method to do this
Open notepad
Type the below code
#echo off
adb connect localhost:5555
Save the file as your_file_name.BAT
Copy the file to Android SDK/platform_tools
Create a shortcut, give it a custom icon, use it anywhere you like
Open the DDMS view from Eclipse, and simply click on the emulator name you want connect to in 'Emulator' tab.
I'm not able to connect to internet on Android Emulator, I'm using Tata Photon+ device.
I've disabled my all other connection like Lan and Wifi...
Removed all other settings like other mobile, and other device dial-up settings.
Please help me, how to connect to internet using android emulator.
My Emulator shows the 3g and signal icons correctly, there is no cross mark on it.
This might be because the emulator is not able to resolve the DNS
Either start the emulator from command prompt like this -
$:\Android\tools>emulator -avd -dns-server 8.8.8.8
You should see a message like this - DNS server name '8.8.8.8' resolved to 8.8.8.8:55
OR
In eclipse Run Configuration -> Select your application from LHS -> Targets tab on RHS -> Additional command line options textbox give -dns-server 8.8.8.8