Bluetooth debugging on android wear failing - android

I've been attempting to debug my android wear app via bluetooth and have been running into a few problems. The main problem is that I'll successfully be running the app and debugging via bluetooth when the connection fails. After the pipe is broken nothing I do seems to get the connection back outside of switching phones. This is obviously not a workable solution, so I was wondering if anyone else had run into any similar problems.

After trying all the steps in #Alex Sulivan's answer, I also tried another suggestion from here which was suggested for devs who have previously connected to an emulator.
open Android wear companion app
Go to Settings Click on Emulator
Click 'FORGET WATCH'
This didn't work either!
Finally, changing the last adb command to
adb connect 127.0.0.1:4444
did the job.
Having done all of the steps, I don't know how many were required.

I've reached some degree of success by re-setting everything and following the developer guide again to setting up bluetooth.
Turn bluetooth debugging off on wear device
Turn ADB debugging off on wear device
Revoke debugging authorization on wear device (not sure if necessary)
Turn bluetooth debugging off on wear app on handheld
kill the adb server (adb kill-server)
Restart adb server (adb server restart)
Turn ADB debugging on on wear device
Turn bluetooth debugging on on wear device
Turn bluetooth debugging on on wear app on handheld
enter adb forwarding commands:
adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost:4444
Pray
These steps have mostly worked for me.

Debugging over Bluetooth was always Off for me. Apparently I had to choose a debugging wearable device here:
Android Wear -> Settings (gear icon) -> Debugging over Bluetooth -> Device to Debug
Then all other comments are helpful too.

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.

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.

Android Studio Logcat not showing Log messages with ADB over Wi-Fi

My device is connected using adb tcpip and the Logcat is not showing Log.i(TAG, "message"). Running abd logcat does not show the Log.i(TAG, "message") either. When using emulators or USB-connected devices, it is working fine. Any solution for this?
On your Android device, in Settings->System->Developer Settings, there is an option (off by default) that says "Enable Wi-Fi Verbose Logging."
Also restart your phone after changing the phone setting, if not working. Make sure to select the correct device used for debugging in logcat window.
also,
In the Device's Developer OptionS: make sure Logger Buffer sizes is NOT set to off
I would set it to the highest if your device can handle it.
What worked for me is this...
Activate "Enable Wi-Fi Verbose Logging" on your android Device
Add "ADB Wifi" to android studio
Run the app on your phone using cable (and make sure logs show)
Connect the phone using ADB, then remove the cable from phone.
Please note that: Step 3 might seem useless but it seems important because it acts as a way to authorize your phone to send logs when you go wireless. There after remove the cable, the logs will show.

check android auto app log messages while connected to car

I have a question on checking logs/debugging of android auto app when the mobile device is connected to the main Head Unit (car).
During apk installation on the Mobile device from the development machine
using Android Studio, the logs can to checked using adb (Android Debug Bridge).
Since it is a development machine, the calls does not go into functions like onCarConnectionCallbacks.
So tried using DHU (Desktop Head Unit), but DHU is connected using adb forward socket connection, How to check for app log messages simultaneously?
And also how to check log messages or debug the app, when it is connected to the main Head Unit (Car), Should the adb be installed? (Here the mobile is not on development mode).
I am not able to find convincing answers online.
Please give your view on this.
Thanks
Having the port forwarded for the DHU connection won’t affect the ADB streaming the logcat in another terminal. You can checkout the ADB documentation on how to Connect to a device over Wi-Fi, and use a laptop to connect with since the usb connection will be used on the phone to connect to the car or DHU.
For the onConnectionCallbacks, those are still functional even when connecting to the DHU. Sounds like it might be a coding issue with registering the connection callback.

Android adb wireless/WIFI debug Operation timed out

I followed steps in this post and tried to connect to my Motorola X Gen 2 for Wifi debugging, on OS X El Cap.
I connected my phone to the laptop with usb cable,
I killed and started server, the server was started successfully, and then in:
./adb devices
I got
List of devices attached
TA44909GA0 device
Then I did
./adb tcpip 5555
And I tried
./adb connect <IP addr of my phone>:5555
both with usb cable connected and disconnected, none of them worked. Both returned error message saying:
unable to connect to ***.***.***.***:5555: Operation timed out
I cannot figure out what is happening here, I tried the Android Studio plugin ADB WIFI, which returned the same message, operation timed out. I restarted everything, tried connecting with a different cable and all, nothing worked.
Does anyone know what's happening here?
Make sure your computer and the android device are using the same wifi network. I had the same issue and fixed it after changing to the same wifi.
So after a huge number of trials, I think the problem is somehow wifi related, I think this feature does not work well with WPA2 (or any kind of?) Enterprise encryption, because I was using my school Wifi, and it turned out to be okay, up and running, for the hotspot I set up with another laptop.
What solved this for me:
disconnect the phone from USB cable
restart the phone
reconnect the phone by USB cable
(meanwhile):
adb kill-server
adb start-server
Then follow the "standard" procedure.
If you are connected on same network and still can't connect then check your IP twice . Sometimes it get changed.
check your IP = phone settings -> About phone -> Status -> IP address
Try increasing the timeout in Android Device Monitor.
From Android Studio: Tools->Android->Android Device Monitor
In Android Device Monitor:
Window->Preferences, Android->DDMS.
In the DDMS window, increase the "ADB Connection Timeout (ms)". It defaults to 5000ms. If your app is particularly large/takes a long time to load, it may go longer than this timeout, so increasing may fix it.
If you are using Mac OS.
Check by clicking on the wifi icon in the toolbar. If there is any warning.
In my case there was a warning saying the wifi is using WPA protocol and its not secure.
I went to my router settings and changes the protocol to WPA2/WPA3 auto.
After that the warning went away and the wireless debugging started working.

Categories

Resources