Android WiFi ADB plugin not working. Giving error - android

I installed the Android WiFi ADB plugin to run the app wirelessly. But it's not working it's giving error that Phone and PC should be connected on the same network. I use my phone hotspot to run the internet on my PC. Then I use another phone but then also same error. Someone says it will not work because you use the mobile hotspot for an internet connection on your PC. But when I try to connect another phone then also the same issue. But the same way my friend also does. he also uses the internet using a mobile hotspot but it's working fine on his phone. I have a POCO F1 Phone.

I'm answering this hoping this may help others as well as I find it helpful for my use.
First, Turn on ADB in your phone's developer options. You can search Your_phone_model developer options to find that.
Second, After turning on ADB, Connect your phone with data cable to your laptop/desktop.
Open a Command prompt window, Type adb tcpip 5555, Press allow in adb prompt shown in your phone, it will show restarting adb in tcpip mode. Now, disconnect the USB cable. You can use different port number to connect another device.
Type adb connect your_phone_ip:5555 as for example adb connect 192.168.43.1:5555 in case of hotspot. You can check Phone's IP in WIFI's advanced setting of your phone or in status section.
Now, Everytime your device restarts, repeat steps 3-4.
You can also make a script, just type adb connect your_phone_ip:5555 in a notepad file, save it as name.bat file, right click on it and send to desktop (create shortcut), in the settings on the shortcut, set any shortcut keys. Now, anytime you want to connect, just press the shortcut keys. That's how I do it. You can further open Android studio by this script so it will open Android Studio as well.
Remember, whenever it says Device is Offline, restarts your phone's wifi and reconnect it.

Related

how to test an app without a USB cable which attaches the device to the debugger?

I'm new to android studio and have just made a new app, which uses position sensors.
All is well when the device is usb connected to the debugger. When I unplug the cable, the app runs fine and I can wave the device around, going to a different room etc. .
But when the app is restarted without that cable, it is "waiting for debugger", which is a little annoying at that point.
I have seen this https://developer.android.com/studio/run#changing-variant but that way I need to sign the app, and I fail on that.
Is there a way to run the app without signing it, and without that debugger cable?
To be more precise in view of the two answers that suggested wi-fi connections (which I can't verify at the moment because the box running AS doesn't have wf-fi connection).
I want to test the app even without debugging, and test it by changing location, too. So I would have to set up a wi-fi connection that would connect to AS over really long distances.
Instead I just want to tell the app (or the device): forget about the debugger.
This: https://stackoverflow.com/a/56541740/4142984 solved my problem.
For the first time you must need to connect device to the android adb and after that you can remove it and still get connection to the android adb.
you should install Android Wifi ADB
you need to connect first time your device with cable in usb debug mode and by using this plugin you can connect your device on the wifi after that you can remove the cable from the system and you will get connected your device to the Android Studio
Note : make sure your system and mobile device must be connected with the same wifi network.
1.Download android-sdk-platform-tools
2. Add the path to environment variables
3. Connect your phone to usb cable
4. Connect your phone and computer in same network(WiFi)\
Now in cmd
5.adb tcpip 5555
6. adb connect *your_phone_ip*:5555
Now you can unplug the usb cable.

Is there a way to build and run an Android Studio app on a phone remotely?

I am developing an app for Android that controls a robot using the FTC SDK, and I need to be able to make small changes to motor values in the code and re-install it to test the new code. My problem is that I need to do this a lot of times, and the system of taking the phone out of the mount (which takes a while) and plugging it into my computer to upload, waiting for it to upload, turning off the power to the robot, plugging the phone back in to the robot, and turning the power back on has started slowing our progress down a lot. I was wondering if there was any way I could install the new code on the phone without taking it out of the mount.
Our phone is connected to a usb hub with a webcam and the hardware controller, so I was wondering if attaching a wireless usb transmitter to the hub and my computer would still let the phone show up on the android studio connections manager and let me install it.
So if anyone has done this before, or knows about any way to make this work, thank you for the help!
Yes. First make sure that the robot phone has developer mode and USB debug enabled.
(Do this by going to settings -> software info and click on build number ten times, then go settings -> developer options and enable USB Debug)
Then, go into the robot controller phone and under the three dots at the top right select program and manage. Connect your computer to the shown internet name and password.
Next if you are on Windows plug in the phone and run the following code in command prompt,
pushd "%userprofile%\AppData\Local\Android\sdk\platform-tools"
adb disconnect
adb tcpip 5555
adb connect 192.168.49.1
popd
PAUSE
If you are on Mac plug in the device and run the following code in terminal,
cd ~/Library/Android/sdk/platform-tools
./adb disconnect
./adb tcpip 5555
./adb connect 192.168.49.1:5555
Finally, disconnect the phone, go back to android studio and happy wireless coding.

ADB offline issue

I made a program to backup files in android devices. To put it simply, it works in background of Windows like a server and when a defined android device (with its LAN IP) connects to home's WiFi network it looks for specific files in specific folders in device and backups them.
My problem is, for some devices (e.g Samsung Note 4), after a few successful WiFi connections (or a few days later) the device starts to appear offline. To fix this, I need to reset the authorities in device or do the reconnection procedure of my program with USB cable again. I researched the web in-depth but couldn't find a way to make offline devices online automatically.
Most of 'ADB offline' solutions on the web works well, but i need to do this automatically over WiFi within my program.
-ADB kill-server & start-server, not working,
-ADB disconnect & connect, not working too.
Disable your antivirus and then try again or add adb.exe as exception in your antivirus.

Android ADB Wifi connection lost/reset

I'm using the Android wifi ADB plugin for Android Studio to connect my phone to my laptop for development purposes. The plug-in is great and does what it's supposed to.
However, I have to set up the ADB via USB every time I start Android Studio.
Clicking on the plug in icon states that there are no connected devices and to review my USB connection.
This also happens if I don't use the ADB for some time.
Is there any way to connect via wifi seamlessly?

ADB, Wifi and Eclipse: how I can configure?

Recently I see that is possible to debug app development by use WIFI instead of USB debug method. I make a search and I found an app called abdWireless but I have a problem.
How I can tell to Eclipse to connect via Wifi method?
I think that it is an automatic process, but on start debug it open the Emulator.
Someone? :)
Bye
First, run 'adb connect ip:port', like adb connect <phone-ip-address>, from console/terminal (with your IP address and port of cause). This makes adb service to connect to your device via network.
Port 5555 is used by default if no port number is specified.
Then check that device is correctly connected: run adb devices from console/terminal (make sure you remove usb cable from device). If adb devices does not list your device, then you have some entirely different issue.
If you've connected your device via adb and you can see the device in adb devices list, but your eclipse still starts emulator,:
Go to Run->Debug Configuration -> [your configuration]
In your configuration go to Target tab and select Manual
This will popup device selection each time you start the app from eclipse. So you will be able to explicitly state which emulator/device to use.
To disconnect your device, adb disconnect <phone-ip-address>
This process can be automated from within Eclipse with Adb Connect:
http://ppareit.github.com/AdbConnect/
I'll try to explain how I connected eclipse with my android device with adb thru wifi on my win7 x32, sharing my internet connection at the same time.
I'm using two methods.
The first one is when my computer is connected the internet (ie. thru ethernet cable), and I'm sharing this connection with my android device thru wifi (like a hotspot).
The second one I use when my computer isn't connected directly to the internet, yet I'm using my device's internet to connect my computer to the internet.
Computer connected to the internet, android device connected to the internet thru my computer.
Note that for this to work, your wireless card must meet certain requirements, as this won't work with all wireless cards.
Well first of all, you need to share your internet connection from your computer. To do that open cmd (command prompt) with administrative privileges (press the win logo, type cmd, and then press ctrl+shift+enter). To set up the "hotspot", type:
netsh
wlan
set hostednetwork mode=allow ssid=Hotspot key=D2D46784ECB32 keyUsage=persistent
start hostednetwork
Change "Hotspot" to whatever you want your ssid to be called. Change "D2D46784ECB32" to whatever you want your key (WPA2) to be.
Now, go to Control Panel\Network and Internet\Network Connections. You'll probably notice a new "adapter" called "Wireless Network Connection 2". Right click on the ethernet connection (or whatever device you use to connect to the internet). Click on properties. Click on sharing. Check the "Allow other network users to connect through this computer's Internet connection". Select the Wireless Network Connection 2. Click OK. What you just did was to start Internet Connection Sharing (ICS).
The next step is to connect your device to the connection you've just created. On your Android device, search the wifi connection, which you'll find by the ssid you've set (ie. Hotspot), and enter the key you've set (ie. D2D46784ECB32). Once the connection has been established, you'll have Internet access.
Please note that sometimes I have trouble with this connection. Sometimes my device is unable to connect (I think that there is a bug in win7). I usually fix this by going to my computers connections, and on my ethernet connection I go to properties → sharing, uncheck the "Allow other...". Click OK. Then again go to that connection's properties → sharing and check the "Allow other…". Basically I've reset the ICS. And now I'm usually able to connect.
Please also note that once you've restarted your computer, I'll most probably have to restart the hostednetwork and reset the ICS.
To stop the hotspot, type:
stop hostednetwork
To start the hotspot, type:
start hostednetwork
Note that you don't have to set the hostednetwork again, just start it. Please also note that you must be in the netsh - wlan mode, (type netsh and then wlan, as before), and the cmd must have been started with the administrative privileges.
Now, if you haven't already done it, turn on your developer options in your android device and turn on ADB over network. After that you'll most likely see an ip address, suffixed by
:5555
ie.:
192.168.137.158:5555
On your computer, open cmd, go to your adt/sdk/platform-tools folder. On my computer it's like this:
cd "C:\Program Files\adt-bundle-windows-x86\sdk\platform-tools"
And type the following:
adb connect 192.168.137.158
You should replace the ip address with the one that was shown in your android device in the developer options. (I didn't need to add the :5555 suffix/port, but you may need to do it).
To check whether the connection was successful, type:
adb devices
(Btw, i'd like to thank inazaruk for his help with this).
Now, you should be able to connect eclipse with your android device thru wifi, as others have explained (run configuration → target → manual).
Computer not connected to the internet. You are using the internet connection of your android device to connect the computer to the internet.
On your Android device, go to Settings → More → Tethering and portable hotspot → Set up wi-fi hotspot. Change the SSID, the key and the security as you please.
Go back one step and turn on Portable Wi-fi Hotspot.
On your computer, connect to your android device via wifi as you'd do with any other wi-fi connection, with the ssid and key that you've set.
Once you've connected, go to Control Panel\Network and Internet\Network Connections, right-click on the wireless connection you've just connected to. Select Status and then Details. Find the IPv4 address of your computer (at least I'm using IPv4, you might use IPv6).
That address might be like this:
192.124.159.52
The default gateway should then be like this:
192.124.159.1
On your computer, open cmd, go to your adt/sdk/platform-tools folder. On my computer it's like this:
cd "C:\Program Files\adt-bundle-windows-x86\sdk\platform-tools"
And type the following:
adb connect 192.124.159.1
You should replace the ip address with the one that was shown default gateway (I didn't need to add the :5555 suffix/port, but you may need to do it).
To check whether the connection was successful, type:
adb devices
(Btw, i'd like to thank inazaruk again for this).
Now, you should be able to connect eclipse with your android device thru wifi, as others have explained (run configuration → target → manual).
Computer and android device connected to the internet via the same wifi modem.
I must admit that I haven't tried this option, but I'm guessing that it's similar as the two methods before. Find the IP address of the android device in the developer options (you should be able to see it when you enable ADB over network). And then on your computer, as before:
open cmd, go to your adt/sdk/platform-tools folder. On my computer it's like this:
cd "C:\Program Files\adt-bundle-windows-x86\sdk\platform-tools"
And type the following:
adb connect <ip_address_of_your_android_device>
.
To check whether the connection was successful, type:
adb devices
Now, you should be able to connect eclipse with your android device thru wifi, as others have explained (run configuration → target → manual).
Now, I know that this isn't exactly the answer to the question. But I did find it very hard to share my internet connection, and then to use the wifi with eclipse to develop apps. After some time, I managed to connect like I've described. So, if I've helped someone to do the same, I'd be very happy :-)

Categories

Resources