telnet on hosted machine running on azure devops pipeline - android

Here is my detail about my problem:
what I want to achieve:
create a pipeline on azure DevOps, containing tasks
create android emulator with internet condition full
run some tests
connect telnet
connect telnet to android console port- send command to android device to change nework condition to low bandwidth as mentioned here (https://developer.android.com/studio/run/emulator-console)
Note: I have hosted MacOS, also telnet+expect and spawn is installed over it
What is the problem:
My android device is running over 5037 port
telnet task output showing me "telnet connected to local host" command I am using to connect to android console port is : telnet localhost 5037 (in a command line task)
escape character is "^]"
**
it is not showing me any authentication required message or OK so I can go ahead with it, also I am trying to send command like expect"^]" returning me nothing
**
I want to run emulator -netspeed gsm #Pixel_API_26 please help

Related

Running Emulators on Different Device for React Native Applications

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

Android Studio telnet console missing "network" and "window" command?

I'm trying to play around with connecting to an Android emulator through telnet, following the guidance of this page: https://developer.android.com/studio/run/emulator-console.html
I successfully connected to localhost:5554, authenticated with the token found in /Users/me/.emulator_console_auth_token, and got a list of available commands:
$ telnet localhost 5554
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: Authentication required
Android Console: type 'auth <auth_token>' to authenticate
Android Console: you can find your <auth_token> in
'/Users/me/.emulator_console_auth_token'
OK
auth 123456789XYZ
Android Console: type 'help' for a list of commands
OK
help
Android console command help:
help|h|? print a list of commands
crash crash the emulator instance
kill kill the emulator instance
quit|exit quit control session
redir manage port redirections
power power related commands
event simulate hardware events
avd control virtual device execution
finger manage emulator fingerprint
geo Geo-location commands
sms SMS related commands
cdma CDMA related commands
gsm GSM related commands
rotate rotate the screen by 90 degrees
However, I noticed that network, window and vm commands mentioned in that page are not in this list. How do I get to run those commands?
Thank you very much in advance!
Matt
this option is available while running the emulator in android studio 2.3.1

dev server returned error code 403 react native

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

Unable to connect backend server with android emulator

Hi i am developing and android application which communicates with the backed server. I Tested my application inside my Working environment its working fine... I am able to connect to the server and i got the response...
But when i went for testing in my clients environment, i was unable to connect to the back end server.. I used their LAN to access web server...
The problem i am having is Unknown Host name..
Insted of giving the host name i gave the ip address to the host and my application got the response successfully from the server, but if i change the ip address to the DNS i was unable to connect..
I Tried several options
Tried to set the host ip address in Eclipse -> Window -> Preference -> Android -> Launch. but it didnt work.
I Tried to launch the emulator from the command line using the following command
emulator -avd MYAVD -dns-server X.X.X.X
this one also didn't work.
Since my time is limited to deploy i need help.

Running android emulator as server

I want to receive the AT command from android emulator and send the reply back from TCP client program which is written in C.
I am running Android ICS emulator on ubuntu-10.4 system as server by giving command "emulator -shell-serial tcp::4444,server" and in another terminal I am running TCP client written in C trying to connect to the same port.
I am able to see the emulator GUI coming up but I am not receiving any AT command in client.
I got the answer, in the emulator command i need to pass -radio instead -shell-serial. now I am able to receive all the AT commands in my client program

Categories

Resources