Android ADB Wifi connection lost/reset - android

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?

Related

Android 11/12 Wireless Debugging not available when using Mobile Hotspot as the network

Before android 11, i was able to wirelessly debug apps using this method
turn on the mobile hotspot in the (target) android phone
connect the computer to the hotspot
run adb tcpip 5555
adb connect [ip of the target phone]
The problem is
Android 11 introduced Wireless Debugging and the above method doesn't work as expected.
And the wireless debugging mode cannot be turned on unless my android phone is connected to wifi
so it is not working because I want to use the target phone's hotspot for wireless debugging.
is there any possible solution?
or
is it possible to turn the wireless debugging mode ON even if the phone is not connected to wifi?
Work Around
run adb tcpip 5555
run adb connect [ip]
go to Settings/Display & brightness/Auto screen off and make it 30 minutes. (means that your phone won't auto lock so it will stay wirelessly connected to ADB)
I hope android engineers will allow using the wireless debug feature without being connected to WiFi in newer versions of android though, as pointed to in the question.

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.

Android WiFi ADB plugin not working. Giving error

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.

Connect a paired bluetooth device via terminal on Android

I need to connect a paired bluetooth devices via the terminal, when it does not connect automatically.
On my Android 7.1 device I would normally click the bluetooth device to connect it, in bluetooth settings. Unfortunately, I do not have a touchscreen or mouse in my setup. So I'd like to use the terminal to connect it. For specific reasons I do want to do this from the Android device, not from a connected PC etc.
I only found a way to enable and disable bluetooth via adb (adb shell service call bluetooth_manager 8). As mentioned I do not want to use adb, but I want to connect from my Android device. Is it also possible to connect to paired devices?

How to Monitor CPU/Memory/GPU Usage of an Android Device without Connecting it to a PC?

Based on my understanding of Android Monitor, an Android device needs to be connected to the machine that is running Android Studio in order to profile CPU/memory/GPU usage. Are there any methods that allow profiling an app without connecting it to the PC? For example, writing the debug info that is generated for Android Monitor in a file and process the file later?
My goal is to gather debugging information without connecting the Android device to a PC (either via a USB cable or over the network).
Your initial work with a device usually needs to be over USB. However, after that point, you can switch using adb over the network, using adb connect. Once you have adb connected over the network, everything works just as if you had connected it via USB, including full Android Studio access.
Bear in mind that:
Some devices do not need the initial USB connection, as they are designed to work with adb over the network "out of the box" (e.g., Fire TV)
I think that older devices may not support this, for some value of "older"
You cannot monitor it without an active debugging connection. That being said, debugging connection isn't limited to USB. You need some kind of connection, and that connection can be USB, but it can also be over the internet(refer How can I connect to Android with ADB over TCP?).
Some devices don't support this, some have a setting for it in developer settings, and using root you don't need a connection. For devices that support adb over the internet, but aren't rooted or have the setting in developer settings, you need to have a usb connection initially.

Categories

Resources