I'm trying to setup my Android/ iOS development environment. My setup includes the following:
A MacOS VirtualBox VM with Android studio and Xcode. The VM is running on a Windows desktop. The network for the VM is currently set up as bridge adaptor.
A Windows laptop with Android SDK and emulator.
All of the above machines are on the same LAN and I can ping one machine from another and vice-versa.
VM with Android Studio - 192.168.1.84
Laptop with emulator - 192.168.1.75
Emulator is running on the laptop on default port - 5554
Emulator IP address in the settings is showing as - 192.168.232.2
After reading the emulator networking guide, I tried setup the following redirection
redir add tcp:5000:5555
Subsequently, I tried connecting to the emulator from the MacOS VM by running the following command:
adb connect 192.168.1.75:5000
The above command resulted in:
failed to connect: '192.168.1.75:5000' - Operation timed out error
Could you please advise what I'm missing here. I need to set this up as I'm unable to run the Android emulator on the MacOS VM due to other constraints.
Any pointers would be appreciated.
Thank you in advance!
Update:
Further to above, I tried to use the following command on the laptop running the emulator to do the redirection:
netsh interface portproxy add v4tov4 listenport=5000 connectport=5555 connectaddress=192.168.232.2
Interestingly, now when I try to run the following adb command from VM containing Android studio, I get the following message -
adb connect 192.168.1.75:5000
already connected to 192.168.1.75:5000
However, the emulator (on windows laptop) name does not show up as a device in Android studio (on MacOS VM) and I cannot run my sample application.
Am I missing anything basic here?
One possible solution that does not requires any port redirection is the following:
On your laptop
Start the emulator
Use adb -a nodaemon server that restarts the adb listening on all the network interfaces
On your VM
Connect to the remote emulator instance by using this command adb -H 192.168.1.75 -P 5037 shell (or instead of shell any other commands)
Tested on Mac laptop and Linux VM.
I have an Android tablet and an old Linux notebook where I developed a program for months, no glitches.
Then I got a new Linux notebook, installed Android Studio, and tried to plug in the Android tablet. The tablet never shows up in the target list; it just says, "Unknown Device." When I select "Troubleshoot device connections," the wizard displays the ID of the tablet, with the cryptic message "Device is currently in the unknown state."
Turning the tablet's "USB debugging" option off and on again does not fix the problem. When I unplug and replug the USB, the tablet chimes, but does not put up a requestor asking if I accept this debugging connection.
Running adb devices returns:
$ adb devices
List of devices attached
adb server version (41) doesn't match this client (39); killing...
* daemon started successfully
B007904026445 no permissions (user in plugdev group; are your udev rules wrong?); see [http://developer.android.com/tools/device.html]
Any tips?
Unplugging and plugging in the USB just one more time finally gave me the requestor on the tablet asking for permission to be debugged by this notebook. End of crisis.
An actual answer how to get that requestor without USB cable abuse would be nice...
while connecting Android phone to computer Select 'File transfer' option in 'Use USB for ' Dialog. this will solve the issue.Tested.
I ran into this issue when connecting a Pixel 2 XL running Android 11 via USB (with USB debugging on). The solution here worked for me:
Run
sudo adb kill-server
and then
sudo adb start-server
then connect your device turn Debugging on and type
adb devices
again. After doing this, the Pixel 2 showed up in the list of devices in Android Studio.
I came across the same issue. By scanning for devices in troubleshooting connections after installing adb, it showed me directly the request for pairing the device. I have similar set up and One Plus 3
Select Revoke USB debugging authorizations to revoke access to all computers you've previously authorized (Settings > System > Developer Options > Debugging).
See more in this post
https://developer.android.com/studio/run/device
add yourself to the plugdev group: sudo usermod -aG plugdev $LOGNAME
install sudo apt-get install android-sdk-platform-tools-common
log out and log in again for the group changes to take effect
If it's still not working, try to:
disable and enable "USB-Debugging" on your developer settings of your Android phone
If it's still not working a not so great workaround is restarting the adb server. Not so great, because adb should not run as sudo:
cd / && sudo find -name "adb" # ADB_PATH
sudo ADB_PATH/adb kill-server
sudo ADB_PATH/adb start-server
sudo ADB_PATH/adb devices
This can happen if you have Chrome inspect or other similar software hanging
in my case I had this error because I was connecting to a HUB USB.
It also happened to me, when I tried to connect my Android Phone in Android Studio.
On my Phone i got the message "USB debugging connected" but the pop-up Window that asks for "allow USB debugging" never showed up. Also in Android Studio the code wasn't uploadable to my Phone.
I also got "Device is currently in the unknown state" in Troubleshoot Device Connections.
The Problem was: my Settings (Connected Devices > USB Preferences) on my Phone were set to "No data Transfer".
I had to enable "File Transfer"
Due to the political prohibitions (country related), unfortunately i am unable to connect to google servers normally, however i have to be able to develop android applications for educational purposes. So i decided to use socks proxy and redirect my traffic through tor so i can be able to get SDK and other API tools and get android studio running. Previously i did this and worked, but now after a fresh ubuntu install and getting the most recent android studio version and following the official instructions, i can't manage to get android studio connect to tor. I tried using the exact host name and port number with other applications and it worked. but i can't seem to find any realted topic to solve my own problem.
Host name: localhost
Port: 9150
Thank you in advance.
Apparently setting the proxy in android studio's settings was not enough.
Besides the starting script must be run like this:
$ torsocks -P 9150 /opt/android-studio/bin/studio.sh
I am trying to run an app from Android Studio on my Ubuntu laptop.
I have enabled USB debugging, but it is still not working.
When I press run in Android Studio, it does not detect my device (LG G3 Lollipop).
I could not find any help :(
First of all,
Open terminal and do following:
Do lsusb command to check your device is indeed connected.
Do adb devices to check if your device is connected then it is detected as in adb mode.
2.a. if the above command is not found, do sudo apt-get install android-tools-adb and then check if it is listed.
Secondly, post results of step 1 and 2 with your question to help us in finding a correct solution.
Troubleshooting:
Make sure adb mode in enabled.
Make sure you have opted for Allow option when prompted for in your device upon connecting to your ubuntu system.
This one is from some past LG users, Try connecting your device in PTP mode rather than MTP mode, it surprisingly works.
If it atill doesn't work, (most likely your case), try googling. I landed upon this page by pressing I'M FEELING LUCKY, you should try to feel lucky once in a while.
Source for step number 3 and 4
follow the steps as mentioned upon page:
Create a file: /etc/udev/rules.d/70-android.rules.
Write: SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666" to the file.
Assign proper permission via sudo chmod a+rx /etc/udev/rules.d/70-android.rules
Reboot the system and restart udev.
As a second step of troubleshooting (make sure you again repeated troubleshooting from step1 in case you failed at this step)
Again, the process:
Create a file: /etc/udev/rules.d/51-android.rules.
Write: SUBSYSTEM=="usb", ATTR{idProduct}=="1004", MODE="0666" to the file.
Assign proper permission via sudo chmod a+rx /etc/udev/rules.d/70-android.rules
Reboot the system and restart udev.
Make sure you have adb installed in your ubuntu system.
If not then type -
sudo apt-get install adb
Provide your system password and press 'Y' asked during installation process.
Then disconnect your device through USB and then reconnect it.
You will have to grant permission for debugging which prompts on your device just after reconnecting.
I faced the same issue but it was my mistake. I didn't turn on the " USB DEBUGGING MODE ".
Settings > Developer Option > Enable USB Debugging Mode.
Try to revoke USB debugging authorizations and then connect your device, it should show permission prompt for authorization.
go to
settings -> developer options -> revoke USB debugging authorizations.
I tried restarting adb using root priviledges and it worked for me. Use these commands in the terminal:
sudo adb kill-server
sudo adb start-server
Hope it works for you too...
For my situation with Ubuntu 16.04, with my device properly connected via USB, confirmed by lsusb
The solution is let the Studio aware of the Android/Sdk folder by defining
export ANDROID_HOME=<the Android/Sdk folder>
in ~/.bashrc
(I have installed the SDK at a custom location)
Then start a new shell, from there re-start the studio, then it works.
I solved with this: https://stackoverflow.com/a/37109216/5081063
If the problem is only on Android Studio and not in your OS you can solve with that.
So first check if adb recognize any devices with:
$ adb devices
If yes, open Android Studio and follow these steps:
Go to Run > Edit Configurations...
Under Deployment Target Options select Show Device Chooser Dialog from the drop-down-list
if you are doing it first time in Ubuntu Linux, then Use sudo apt-get install to install the adb package. This gives you a community-maintained default set of udev rules for all Android devices.
or, use
sudo adb kill-server
sudo adb start-server
and check using
sudo adb devices
you can also check uncheck the usb debugging option, in your developer option in the phone.
follow this link for more info.
Run apps on a hardware device
Enable USB Debugging from Settings->Developer Options
Enable Developer Mode by clicking on build number several times
My device appeared as unrecognized and when I ran adb devices fom android-tools directory it said: adb not a command. Strange. So what I did is installed adb tools additionally and then run adb devices:
sudo apt-get install android-tools-adb
89LY0810Y unauthorized
Then I saw the dialog on my device and selected: Always authorize.
Please make sure your device is in debug mode.
If you have tried many terminal commands to connect your physical device to android studio in ubuntu and you failed to connect try this :- Connect your device and change your USB preference(device notification) to PTP,android studio will detect your device.see this image
I had the same problem, as I had enabled the USB Debugger but it was my first try so I didn't know what to expect. If you answer "yes" to "use as storage device," you will set it to mtp, if you answer no, after that you will have the option to connect on debug mode and it will appear.
I was using a Samsung A31 and Debian
After trying a lot of different solutions, I notice that the problem was my cable, so I changed it and now it works.
Thanks to RazorHail Answer.
Learning how to deploy the demo project to IBM API Connect on Bluemix (get-started) and get the following errors after run apic edit to start IBM Developer Toolkit local site:
Screenshot of the error
Any suggestions will be appreciated.
Just tried the same and I am not able to reproduce the issue, since the "apic edit" step works fine for me. I guess this is an issue related to your machine. The error is quite clear and it means that Express.js is not able to connect to that port. The first step is to check that port to see if it's blocked by the host system. However I see different ports in the error message, so the problem could be different (check your firewall settings). Moreover, I would try to install apic again running sudo npm install -g apiconnect and double check that the prerequisites are already installed. It could be throwing an error that you didn't notice.
Try publish in the interface 0.0.0.0:
export HOST=0.0.0.0
apic edit