How to connect Android phone with adb using PC's hotspot? - android

I want to connect my Android phone with ADB to desktop PC. I use a MiWiFi USB dongle to hotspot on desktop. Desktop PC connects to internet with ethernet cable. On my phone, I connect the internet with this hotspot. How can I connect Android phone with adb to desktop using desktop's hotspot?
When I connect PC and phone to same WiFi, ADB connection is perfect.
But when I connect phone to pc's hotspot, adb connection fails.

Related

Cannot connect to ssh server on android from pc via usb port forwarding

I would like to connect to an android device via ssh and a usb cable from my linux pc which does not have any wireless connection. USB debugging is enabled. Ssh server is sshdaemon from f-froid.
Here's what I did.
Run adb forward tcp:8022 tcp:8022 on pc.
Start sshdaemon on android device and it listens on 10.252.124.145:8022
Run ssh -p 8022 10.152.124.145 on pc and got a Connection timed out response after a couple of minutes.
Help would be much appreciated.

Run/install/debug android app wirelessly but over its own portable hotspot

we know how to develop and connect wirelessly over Android phone to Android Studio.
Is there a way to connect to same mobile which internet we are using by making portable hotspot ?
Yes I have done it for long time. connect the laptop to you phones hotspot, then go to the about phone->status see the ip address and the connect mobile with laptop with usb cable and run command adb tcpip 5555 then adb connect <your ip addrss> Now you can disconnect your usb cable. Your mobile will be shown in the run dialog.
Note: you must have adb on your pc and its path declared in the environment variables.

connect to Raspberry Pi 3 using adb

How do I connect w/ adb to the Raspberry Pi 3 running Android Things?
Android Things for Raspberry Pi only support connecting to adb using adb-over-ip with the following command:
adb connect `<raspberry-pi-ip-address>`
You have multiple options to find your IP address depending on your Pi setup:
If your Pi is connected to Ethernet and a screen: it should show you its IP address on the Android Things launcher screen.
If you have a headless Pi connected to Ethernet: you can directly ping Android.local if you have mDNS/Bonjour support, or see https://learn.pimoroni.com/tutorial/raspberry-pi/finding-your-raspberry-pi for info on how to find your Pi IP address using third-party tools.
If you don't have any screen or Ethernet connection, you can connect a USB to TTL serial cable on the UART0 connector (see pinout and type the following command to connect to a WiFi network and get the Pi IP address:
am startservice -n com.google.wifisetup/.WifiSetupService \
-a WifiSetupService.Connect \
-e ssid '<NETWORK_SSID>' -e passphrase '<NETWORK PASSPHRASE>'
ifconfig
Follow the steps :
it worked with my version of Android [5.0]
Install ConnectBot
Install ConnectBot on your tablet which is an Android terminal emulator available from Google Play. It allows to SSH into the Raspberry Pi.
Configure the Raspberry Pi
You can perform those changes when connected via any method to your Raspberry Pi.
Add the following lines into your network configuration:
vi /etc/network/interfaces
allow-hotplug usb0
iface usb0 inet dhcp
When you would have already connected all devices, and you do not want to reboot, just restart the network:
/etc/init.d/networking restart
Connect your devices
Connect your Android Tablet to a Raspberry Pi USB port via a micro-USB cable. Power your Raspberry Pi with a standard USB power supply. You can use any DC USB power supply.
**Enable Android USB tethering
Enable USB tethering on your Android tablet.
*Settings → Connections → Tethering and Wi-Fi hotspot → USB tethering**
Now the Raspberry automatically gets an IP address via its USB0 port. The Android tablet behaves like a NAT router. This should work both when your tablet is connected to Wi-Fi or to a mobile 3G/4G network.*
Initiate an SSH login to the Raspberry Pi
Start the ConnectBot App on Android
Login to the Raspberry Pi via SSH
The only problem is that you have to know the IP address of the Raspberry Pi; it seems to be (always?) 192.168.42.159...
Network setup
This part has to be done by your self using your SSH and local network config.
Download a terminal emulator from Google Play (there are lots that are free). Make sure that your Android device is connected to your Wi-Fi and get the Wi-Fi IP address. Open the terminal program and type:
su
setprop service.adb.tcp.port 5555
stop adbd
start adbd
Now go to your computer (assuming that you are using Windows) and create a shortcut on the desktop for "cmd.exe" (without the quotations).
Right click on the cmd shortcut and choose "Run as Administrator"
Change to your android-sdk-windows\tools folder
Type:
adb connect ***wifi.ip.address***:5555
(example: adb connect 192.168.0.105:5555)
adb should now say that you are connected.
Note: if you are too fast to give the connect command it may fail. So try at least two times five seconds apart before you say this doesn't work.

Testing my app on a physical device

How can I test my app on a physical device on the LAN when the android mobile is connected to the LAN through the WiFi?
No virtual emulator no usb connect?
Using android adb command you can achieve this. For using adb you have connect your physical device with your system at once with usb cable.Fallow this setp
Connect your Android device and adb host computer to a common Wi-Fi network accessible to both.
Connect the device to the host computer with a USB cable.
Go to folder adnroid sdk>platform-tools>
Set the target device to listen for a TCP/IP connection on port 5555.
$adb tcpip 5555
Find the IP address of the Android device. For example, on a Nexus device, you can find the IP address at Settings > About tablet (or About phone) > Status > IP address. Or, on an Android Wear device, you can find the IP address at Settings > Wi-Fi Settings > Advanced > IP address.
Connect to the device, identifying it by IP address.
$ adb connect
exp : $adb connect 192.168.10.20
Disconnect the USB cable from the target device.
Now you can test your app on a physical device on the LAN when the android mobile is connected to the LAN through the WiFi.
for more details http://developer.android.com/tools/help/adb.html

Connect ADB in Wireless mode with PC(Connected with ethernet)

I have a google nexus 7 tablet and i am able to test the application in eclipse through usb debugging over USB cable, but i need to debug over wifi which is connected in my nexus 7 tablet and my PC is connected through Ethernet cable.
Both have internet connected with the same router, i.e PC with "ethernet" and tablet with "Wifi"
i have made a try like below
adb tcpip 5555
adb connect 10.0.0.7(this is my device ip address)
but no luck..
How do i achieve the wireless debug application from this scenario..
Helps appreciated..
Enable wireless debuging from developers options and get the ip adress of tablet. You may need some custom roms to have this feature.
Go to the adb.exe directory. It should be in sdk/platform-tools
Open the command prompt there.
Write the command
adb connect 192.168.1.32 (Where your devices ip adress)
Good luck

Categories

Resources