rendiix / termux-adb-fastboot

android adb-fastboot tools for termux
Apache License 2.0
549 stars 82 forks source link

Upgrade adb to support Wireless debugging? #2

Closed luciferz2012 closed 3 years ago

luciferz2012 commented 3 years ago

As described here https://developer.android.com/preview/features#wireless-adb

tathastu871 commented 3 years ago

It was for android 11

teou1 commented 3 years ago

Any progress with compiling adb 1.0.41 (api 30, Android 11) binaries for arm64?

It can be a gamechanger: adb phone to phone without the need for a pc the first time and without otg cables... And even adb to itself would be possible, when pairing command is supported.

tathastu871 commented 3 years ago

Any progress with compiling adb 1.0.41 (api 30, Android 11) binaries for arm64?

It can be a gamechanger: adb phone to phone without the need for a pc the first time and without otg cables... And even adb to itself would be possible, when pairing command is supported.

Already possible to adb phone to phone via otg. Also adb to itself without need of another phone or pc via adb connect localhost

Just one step needs the pc that is setting up adb in tcpip mode after that its all pc free. And if phone is rooted that step is also gone

teou1 commented 3 years ago

Adb to itself does not seem to work by me, Android 11 unrooted with termux and MasterX adb version:

$ adb connect localhost unable to connect to localhost:5555: Connection refused $ adb connect localhost:5037 unable to connect to localhost:5037: Connection refused $ adb connect localhost:5038 connected to localhost:5038 $ adb devices List of devices attached

$ adb shell error: no devices/emulators found $ adb disconnect disconnected everything $ adb version Android Debug Bridge version 1.0.39 Revision android-8.0.0 arm

In a terminal emulator without termux i get even less, access denied or not exist.

And yes, i am aware of the other 2 possibilities -pc and otg cable, would be nice to get without them, pure wireless.

teou1 commented 3 years ago

Thanks to osm0sis and surge 1223 we now have a solution to that problem. So, download adb.bin somewhere on your phone from here https://github.com/Magisk-Modules-Repo/adb-ndk/tree/master/bin Then use fx file explorer - connect to - left menu, termux, to authorize fx to see part of termux filesystem and transfer adb.bin there. Do not try to do it from termux itself: you'll be greeted with an error later on, because of the enforced no execution policy on Android 11 (good for virus protection, bad for power users, see here https://github.com/termux/termux-app/issues/1072 ). As next step you run termux and chmod +x adb.bin just to be sure. Now you can ./adb.bin and read the help how to pair and then connect. Remember there are different ports for pairing and connecting.

shantnubiswas commented 3 years ago

Thanks to osm0sis and surge 1223 we now have a solution to that problem. So, download adb.bin somewhere on your phone from here https://github.com/Magisk-Modules-Repo/adb-ndk/tree/master/bin Then use fx file explorer - connect to - left menu, termux, to authorize fx to see part of termux filesystem and transfer adb.bin there. Do not try to do it from termux itself: you'll be greeted with an error later on, because of the enforced no execution policy on Android 11 (good for virus protection, bad for power users, see here termux/termux-app#1072 ). As next step you run termux and chmod +x adb.bin just to be sure. Now you can ./adb.bin and read the help how to pair and then connect. Remember there are different ports for pairing and connecting.

Does it work for connection adb on same device without root if yes the what commands did you used?

I tried /data/data/com.termux/files/home/adb.bin start-server Then adb connect localhost:5037

But when i tried list with both the commands they show but an empty list. And now i am depressed again please help me @teou1.

This is the adb i installed on my device

teou1 commented 3 years ago

You are using the wrong binary (use the one from magisk) AND the wrong command :) Do you have an Android with wireless debugging in the developer menu, android 11 and maybe 10? Have you tried a wireless connection with pin from a pc, to be sure everything works?

If you had, you had known, the new command is adb pair localhost:12345 , then adb connect localhost:54321 Read the help once more please.

What you are doing is ok for every android version, but with that method you still need usb cable to allow the connection once and to switch to tcp server. As i said...read the help and play everything once more on a pc first because right now you do not know what you are doing. Here is a begginers guide (terrible site but the first google result) https://android.gadgethacks.com/how-to/set-up-wireless-debugging-android-11-send-adb-commands-without-usb-cable-0302898/

shantnubiswas commented 3 years ago

You are using the wrong binary (use the one from magisk) AND the wrong command :) Do you have an Android with wireless debugging in the developer menu, android 11 and maybe 10? Have you tried a wireless connection with pin from a pc, to be sure everything works?

If you had, you had known, the new command is adb pair localhost:12345 , then adb connect localhost:54321 Read the help once more please.

What you are doing is ok for every android version, but with that method you still need usb cable to allow the connection once and to switch to tcp server. As i said...read the help and play everything once more on a pc first because right now you do not know what you are doing. Here is a begginers guide (terrible site but the first google result) https://android.gadgethacks.com/how-to/set-up-wireless-debugging-android-11-send-adb-commands-without-usb-cable-0302898/

Can i use same steps on android 9? And i don't have any pc so if you can help me to do this without a pc then i will be very greatful of you(i know my english is bad please bare with me). •‿•

teou1 commented 3 years ago

No. The new method is introduced in the middle of 2020 with some very late update of Android 10 and early beta of 11.

On android 9 you follow the old guides like https://support.honeywellaidc.com/s/article/How-to-use-adb-over-TCPIP-connect You need a cable connection to start the server on port 5555 and then it will work wirelessly until you reboot the phone.

p.s. I have seen some apps on google play https://play.google.com/store/apps/details?id=com.htetznaing.adbotg that use 2 phones and otg cable, have not tried personally.

rendiix commented 3 years ago

update latest platform tools

chaoscreater commented 2 years ago

on Android 11, turn on wireless debugging and look at the port generated (it'll be random everytime). Then in Termux, run:

adb connect localhost:port (where port is the one you got from wireless debugging). This will pair Termux to wireless debugging.

Once done, Termux should be able to run adb commands, such as "adb devices -l" to list the currently connected adb devices. All this is done without another device.

You can also run "adb tcpip 5555" (after the above steps have been completed) and this will allow Tasker or MacroDroid to run more ADB elevated commands.

The problem is trying to automate the first part. There's a Google Play app called LADB and once you've done the initial pairing of LADB with wireless debugging, then it'll survive phone reboot. This means that the next time you reboot your phone and run LADB (with wireless debugging turned on of course), LADB will automatically pair with wireless debugging. So it should also be possible for Termux to do the same.

teou1 commented 2 years ago

And a small addition: might be needed to go split screen, because android changes the pin every time the window is refreshed.