Android tcpip ADB session disconnects when accessory is attached - android

I am developing an ADK application using Windows 7 x64, API 15 with a target of an Acer Tab A100 running Android 4.0.3 and an Arduino with a USB shield. The tablet is not rooted.
I am able to successfully setup ADB to run over tcpip using the following command in a Windows command shell:
adb tcpip 5555
adb connect X.X.X.X
I then disconnect the usb cable from the Windows 7 PC and connect it to the Arduino. The Arduino is running the ADK code and the tablet prompts to launch my application. The application launches and runs fine. However, when the Android application launches the ADB session terminates and I have to re-execute the adb connect command to re-establish it.
This doesn't seem like it should be happening. Does anyone have any thoughts how to fix it?
Thanks,
digitalhack

ADB server can be started from android ADK based application, it will communicate with firmwate in the Arduino.I developed one project using ADB communication with Arduino, work fine.
Thanks

It shouldn't be necessary to use ADB for app communication over USB. I'm deep into this right now and am trying to get openAccessory to work for this exact purpose (communicating with Arduino). openAccessory causes the Android device to operate in "device" or "slave" mode, permitting the Arduino to be run in "host" or "master" mode. Since the USB host is the one that powers the USB bus, this permits the Arduino and its (presumably) more powerful power supply to power the Android tablet rather than the other way around.
Read up on openAccessory mode in the Android API, and report back on your results!

Related

How to run app on moto 360 from android studio

I'm using the sample watchface app and have followed all the steps
(developer.android + several variations from this site) to run something on my watch but with no joy. Wondering if anyone can advise please.
Phone (moto 4G) is connected to PC by USB. USB debugging is on in Settings and Debugging over Bluetooth is on in Android Wear app. Paired watch (moto 360 2gen) has ADB Debugging enabled and Debugging over Bluetooth enabled.
Android Studio lists the phone if I run the phone module part of the app; it offers no compatible devices if I run the wearable module. Adb devices command just lists the phone. On the phone in the Android Wear app under Debugging over Bluetooth it says
Host: disconnected
Target: connected.
When I look on the phone in Settings, Apps a watchFace app has appeared but there's nothing on the watch (tried to change watch face, nothing new; no new app).
I tried
adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost 4444
but the second command gives
'unable to connect to localhost:4444 ... no connection could be made because the target machine actively refused it (10061).'
I also tried
adb connect 127.0.0.1:4444
which does connect but AS says it's offline.
Can anyone help?
After trying the above procedure many times it seems that sometimes it works and sometimes it doesn't! I haven't yet found what makes the difference but suspect either (a) not leaving enough time between connecting phone and entering adb commands or (b) simple PC running too slowly.

USB Debugging over Wifi

I am unable to debug over wifi.
I have followed below steps.
Go to Android Sdk-> Platform-tools and type cmd
run adb tcpip 5555
adb connect and MY IP ADDRESS
Now i got the result show in below Image.
After my device is connected. I removed my USB cable then i got device list empty.
I have no idea why this is happening.
I have motorola X play Mobile Phone Android 6.0 and having Windows 10 operating System.
Need Help.
For simple one click connection of ADB over wifi - You can try using the Android ADB Plugin from JetBrains. The plugin will internally handle all the setup and you can click-away and connect to adb over wifi without worrying about anything else. Steps to install and use can be found on its GitHub repo page.
Provides an action which allow you quickly connect your Android device
over WiFi to install, run and debug your applications without a USB
connected by pressing one button. Connect your device using a USB
cable and press the Android WiFi ADB button. Once the device be
connected over WiFi you'll see an IntelliJ/Android Studio
notification. Now you can disconnect your USB cable and enjoy
deploying, running and debugging your applications over WiFi. The
version 2.0 enables a window to check which of your devices are
connected or not and connect/disconnect it manually if needed.
Screenshots from the plugin page:

Adb wifi connection with Android 6.0

I have a Nexus 6 device with Android 6.0, stock version without root. To avoid to permanently connect device with usb cable i used this procedure:
I connected the device by USB cable to PC
type on terminal adb tcpip 5555.
type adb connect <device-ip>:5555 to connect in wifi mode.
When i try to deploy an app from Android Studio, the connection is lost.
I used this procedure many times and with other devices (without Android 6) and i have no problem.
Any idea?
My device with Android 6.0.0, too, failed to connect, but after the official upgrade to 6.0.1, this problem was solved.
It works for my G-TiDE V7s (Android 6.0),
I just discovered that I don't need usb cable, not even for the first time as many people think so.
Its just: (do not use usb cable at all)
adb tcpip 5555
Then
adb connect <device-ip>:5555
If you use windows... (no need for cable at all! Root users)
Craigs auto wifi adb..
Auto connects to pc
Auto reconnects if wifi is dropped
The apk contains the windows client
No typing involved at all for rooted users, no scripts, run the app on android boxes/phones all at the same time!
https://play.google.com/store/apps/details?id=controller.adb.craigs.craigswifiadb
After you enter
adb connect <device-ip>:5555
you don't need to connect in Android Studio. It's already connected, just run the project and your phone will be in the list without using a cable.

Debugging in Android device over wifi without rooting [duplicate]

This question already has answers here:
Run/install/debug Android applications over Wi-Fi?
(41 answers)
Closed 6 years ago.
Is there any possible way to debug or run android apps from eclipse to my Sony Tablet S over wifi rather than USB without rooting the device?
There are ways to do it, if the device is rooted. However, I am seeking the solution in a device that is not rooted.
Disconnect device from usb then tell it to listen on 4455
adb tcpip 4455
restarting in TCP mode port: 4455
connect to the device using a specified ip:port. my device is using wifi
adb connect 192.168.1.103:4455
connected to 192.168.1.103:4455
now do normal adb commands over tcp like
adb shell
when your done, you can put it back in USB mode
adb usb
restarting in USB mode
After a bit of dabbling with testing I successfully managed to connect a Sony Tablet S over ADB following this procedure, when both the computer and the tablet were on the same wifi network. I used an Xperia T as a tethering point between a laptop and the Tablet S. I followed the same procedure on an Xperia Tablet S and an Xperia S as well.
Connect the Sony Tablet S through USB to a computer, make sure you have ADB debugging enabled on the tablet.
On the computer, execute "adb devices", verifying the tablet is showing up in the list of available devices.
Execute "adb tcpip [port]" while the tablet is connected to the computer, verifying you get a response "restarting in TCP mode port: [port]"
Disconnect from the device from the computer it was connected to.
From a host located on the same wifi network, execute "adb connect [ip to device]:[port]", verifying you get a response "connected to [ip to device]:[port]"
In the end I launched Eclipse, created a test project and tried launching the project. The project installed and launched automatically from Eclipse. I also tested this for debugging and that worked equally well.
Finally After lots of search, here is the consolidated, short tutorial about "Wireless Debugging with Android without rooting" your android phone.
Steps:
Make sure your Phone and your PC/Laptop is connected in the same network.
Find your Android Device's IP Address: Go to Settings > About Phone > Status. Note down it.
Ping Test: Lets first check if your phone is accessible from your PC/Laptop to do this ping your Android Device and check its response. See Notes if ping is unsuccessful.
e.g: ping 192.168.1.55
Connect your Android Device Via USB in USB Debugging Mode.
Open command prompt and cd into <Android SDK Folder>\platform-tools directory and run the following commands.
adb tcpip 5555
adb connect DEVICE_IP_ADDRESS_HERE:5555
If you want to switch back to USB mode, use the following command.
adb -s DEVICE_IP_ADDRESS_HERE:5555
Disconnect Android Device from USB. If everything is fine, you can Wirelessly debug your Android Apps!
Notes:
If ping is unsuccessful, Make sure Wireless (WiFi) devices and wired devices are not isolated. If Isolated, you need to disable isolation. Router Mfgrs calls it as AP Isolation. There will be a setting in Router's Wireless Configuration page. I have D-Link Router, I unchecked the Enable MultiAP Isolation setting in Wireless Basic Setup Page.
I personally felt this method of connecting is taking more time.. so, I configured my android device so it uses static IP like 192.168.1.55 to connect to my router and I made a windows batch file like below,
#echo off
cd C:\AndroidSDK\platform-tools\
echo make sure your your Phone is connected in USB Debugging Mode.
pause
adb kill-server
adb tcpip 5555
adb connect 192.168.1.55
pause
so, every time I have just need to plug in my device, and double click the batch file and all done automatic :P !
(No root required) There is one best, easy and with UI method for Android Studio
IntelliJ and Android Studio plugin created to quickly connect your Android device over WiFi to install, run and debug your applications without a USB connected. Press one button and forget about your USB cable.
just install plugin Android WiFi ADB
Download and install Android WiFi ADB directly from
Intellij / Android Studio: Preferences/Settings->Plugins->Browse Repositories
.
Remember! for first time to initialize the device you must have to connect using usb
Alternatively, you can download the plugin from the JetBrains plugin site and install it manually in: Preferences/Settings->Plugins->Install plugin from disk.
for more information read here https://github.com/pedrovgs/AndroidWiFiADB

Control a serial device (like usb printer) from an Android app

I have two questions about Linux Android.
In the documentation it says:
"Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device."
And apparently there is a way to send a command to serial port (USB) from ADB (Android).
So, I need to send commands (like AT commands) from android device to usb device (printer)
1) The ADB will be present on a real device with android?, which version?
2) is there another alternative?
Thanks in advance
And apparently there is a way to send a command to serial port (USB) from ADB (Android).
Not that I am aware of.
The ADB will be present on a real device with android?
adb is a program that is part of the Android SDK. It runs on your development machine. It does not run on the emulator. It does not run on the device.
is there another alternative?
Use the USB APIs and the Open Accessory Development Kit, perhaps.

Categories

Resources