I'm trying to enable CheckJNI in order to debug my native code (see http://android-developers.blogspot.ch/2011/07/debugging-android-jni-with-checkjni.html).
I have a Galaxy S3 with the google USB drivers installed. I can install app and see my device when I use eclipse.
My problem is that I can't send any commands from cmd.exe to my device (it says "error : device not found"). I tried to send adb shell setprop debug.checkjni 1 but I always got the same error.
I tried a different USB port, a different USB cable and I tried to start cmd.exe as an Administrator but I always got the same result. Anyone has had the same problem ? Any idea what I can do ?
Thanks
try restarting ur device and computer also
then execute following commands:
adb kill-server
adb start-server
and then see if it show device using
adb devices
for available device
then you can run commands in ur device using
adb shell ......
After trying to send commands to 2 differents devices on 2 different computers with Windows 7, I finally installed a virtual machine with Ubuntu and there I could access my devices with command lines.
Related
Sorry for the nooby question, I am having trouble sorting this out using the web.
I am trying to simply connect my device to my pc via adb to debug my application.
My device is rooted. Adb debugging is enabled. I downloaded an adb running application and started ADB.
Now i am trying adb connect ip:5555. and keep on getting "unable to connect to ip:5555" ...
Same happend when i try to connect via usb.
c:\>adb connect 192.168.20.191:5555
unable to connect to 192.168.20.191:5555
Help...?
EDIT:
C:>adb devices
List of devices attached
06fecaa1 unauthorized
Launching Cordova
Open Node.js / CMD
Point to "the directory where you have located your source folder" >>> C:\Projects\RJX
Enable Wifi
Turn on Developer Option under settings
Enable / Check USB Debugging Option under settings (Google if cannot find this option)
Enable / Check the MTP Option under settings (Google if cannot find this option)
ADB Commands
adb kill-server
adb start-server
//plug off cable from mobile and plug in again if you connected your device earlier
//Uninstall the application from mobile if you already installed. (if necessary)
adb tcpip 5555
adb connect "ip" //adb connect 192.192.2.128
adb devices //to check device details
cordova run android --device
if this steps are not worked, try to close the cmd and do it again. Sometimes it needs some refresh.
**Android devices version 4.0.4 and after should be no problem if you follow these steps.
I will assume you are able to understand adb connect / ip's etc I won't bore you with that
but there are two lame "gotcha's"
THE GENYMOTION GOTCHA
genymotion WRECKS a lot of this sometimes.. I am sorry but it does.. it has a "I know what I am doing I am taking over" mentality.. sadly it doesn't know what it's doing :-P often you have to turn off genymotion for the adb->usb to work.. basically connect phone FIRST ... make sure it's there in eclipse (adb kill-server / start server if needs be ), then AND ONLY THEN then genymotion AFTER
THE OOPS [/facepalm] GOTCHA
check that your phone it isn't in Windows merely as a "Camera" - go to My Computer and look. If it looks like this pic it's that you're not running Samsung Kies(/disabled because it's annoying) the phone still goes "blub bling" when you plug it in, it may be connected via wifi so have a LAN ip but it is NOT really "connected" to ur PC. instead run/download/update this (with phone disconnected) then make sure Kies is happy AND MAKE SURE MTU is enabled
This error happened to me when PC was (accidentally) NOT in the same network as Android. When I logged on Android to the same WIFI network as PC it now works perfect and I don't have this problem.
The answer here is that it's not listening on the correct (default) port. So you need to set the TCP/IP port to 5555. Connect your device via USB and issue the following command in cmd (terminal):
adb tcpip 5555
Following this your adb connect should work fine, e.g.:
adb connect 192.168.0.n
Hope this fixes it for you.
This happened when I was previously connected with one device (e.g. apps2fire) and then tried using adb command from another machine. I rebooted the Android device and then tried again and received the prompt to allow the connection as I would have expected.
First, check your ip address in your device, then following this command.
adb kill-server
adb tcpip 5555
adb connect [your-ip-address]:5555
The emulator is running. But when I write adb shell in my shell I get:
error:device offline
What is the reason for this? How do I get rid of it?
If "adb devices" lists your device but as "offline" chances are your path leads to an old version of adb (eg 1.0.29) which has problems with latest Android 4 devices.
Make sure "adb version" returns 1.0.31 or greater.
Starting with Android 4.2.2, you must confirm on your device that it is being attached to a trusted computer. It will work with adb version 1.0.31 and above.
It happened to me once. I just rebooted the device, and this solved the problem for me.
When I got that same error, I just unplugged and plugged in it and the error disappeared.
Try to run:
adb kill-server
adb start-server
Still device offline, please restart device.
I restarted my computer, and at the same time I rebooted the phone. The adb devices returns fine.
Method 1 :
run this commands in your linux terminal
sudo adb kill-server
sudo adb devices
run this commands in your CMD
adb kill-server
adb devices
"adb devices" result must show any device with id. If instead of id you are getting off-line means you need to give permission in your tab. Once you enable USB Debugging in android and connect the device for the first time you will get an alert dialog for giving permission. If you are not getting any pop-up then click on Revoke USB Permission in Developer option the try once.
Method 2:
Change the device connected mode from Media to Camera, sometimes this helped me.
Method 3 :
Update the adb as well as device drivers.
If you are connecting through USB, unplug and plug it in again.
If you are connecting over WiFi, disable and re-enable WiFi on the phone.
If you are on Linux or Mac, and assuming the offline device is 'emulator-5554', you can run the following:
netstat -tulpn|grep 5554
Which yields the following output:
tcp 0 0 127.0.0.1:5554 0.0.0.0:* LISTEN 4848/emulator64-x86
tcp 0 0 127.0.0.1:5555 0.0.0.0:* LISTEN 4848/emulator64-x86
This tells me that the process id 4848 is still listening on port 5554. You can now kill that process with:
sudo kill -9 4848
and the ghost offline-device is no more!
Make sure you're superuser..
Instead of 'adb start-server' do 'sudo adb start-server', enter your password (it will not echo), press enter.
Then, 'sudo adb devices' and it will show as online.
I came with this condition twice.The first time I used the command "adb kill-server" in my PC, and restarted the android device. It worked. However the second time the method didn't work any more.This time I disconnected and reconnected the network. It worked.
This happened to me running Ubuntu 19.04 and Android 9. I fixed this by turning off developer options then turning it back on. And make sure USB Debugging is allowed in there as well.
Install this tool (link) and try the following code, do not forget to have the device connected and be attentive to any message.
cd .... platform-tools/
adb kill-server
adb start-server
I went to my phone settings>>Developer options>>Debugging and turned on this option:
"Allow ADB debugging in charge only mode" then this problem solved for me.
hope to solve for you too.
for me, it was by enabling USB Debugging in developer option:
just run adb install apk path after and it will works
In my case
adb kill-server
adb connect [ip_address_of_device]
try following solutions
make sure USD debugging & WIFI debugging is enabled in develop options
make sure PC & mobile both connected with same WIFI
if still doesn't work disconnect & reconnect the mobile and run the command again
When I type adb devices command on terminal, it shows device is connected
List of devices attached
0123456789ABCDEF device
But when I type adb logcat command, it hangs with below message
waiting for device
Can anybody tell me what is the problem behind this? I test the device on cts.
I am not pretty much sure if this works for you but can you please try the steps below:
# Kill and restart
$ adb kill-server
$ adb start-server
daemon not running. starting it now *
daemon started successfully *
# Device appears, but is listed as offline
$ adb devices
$ adb logcat
I have also experienced similar problems I think I solved it by having the USB debugging option switched on within Developer Options in Settings.
REPEAT The following steps above, it should work!
Here is yet another potential method to solve this -- in the past, the above solutions will work, but in my case, this time, this was the thing that fixed it:
Plug device into USB
Settings -> Developer Options
Revoke USB Debugging Authorization
Unplug Device
Repeat Step 1
Authorize Device
Repeat Steps 4&5
adb devices
should now show device
adb logcat
should now output logs from device
I had this same problem on Ubuntu 12.04. Thankfully MickeyMicro had the solution that worked for me:
Run the command:
gksudo gedit /etc/udev/rules.d/51-android.rules
Add the following line to the blank file
SUBSYSTEM=="usb", ATTR{idVendor}="2080", MODE="0666" (I used this one on 12.04)
SUBSYSTEM=="usb", SYSFS{idVendor}="2080", MODE="0666" (Another recommended for 10.04)
Save and close gedit.
Run the command:
sudo chmod a+rx /etc/udev/rules.d/51-android.rules
Restart the system.
Run the command:
sudo sh -c "mkdir -p ~/.android; echo 0x2080 > ~/.android/adb_usb.ini; adb kill-server; adb devices"
Verify that you have permissions to access the device. adb devices should return normal response, rather than a "???????????? no permissions" message.
http://forum.cyanogenmod.com/topic/23163-need-help-for-adb-connection-on-ubuntu/
I got Nexus tab today and I had to go to Settings -> About Tablet -> (tap 7 or 8 times) on Build Number.
Then 'Developer Options' showed up above 'About Tablet'.
Next in Developer Options, after enabling USB Debugging I was able to get the logs
For Mac Users:
cd /Applications/Android/sdk/platform-tools
./adb logcat
When I have experienced this infinite "waiting for device" on Windows I had simply forgotten to enable usb-debugging in the developer options of my device.
What OS are you using? It can be a variety of different reasons. Did you make sure you only have either the emulator running or a device attached? If so, you can direct your adb command by using the -d or the -e flag.
I had similar problem on Galaxy S3, with adb running on Ubuntu 11.10 OS. In my case, If I reconnect the device (pull the USB connection and reconnect it), the log cat starts working. This happens only for the first time I connect the device after powering it up. Once logcat starts working, then it continues to work smoothly, without needing to reconnect.
This happend to me on OS X mountain lion. To fix it I had to
open Activity Monitor, filter all processes named "adb" and force quit them (I had 3 running). Then reconnect the device and everything was working again.
On my Samsung Galaxy S4 I had the same problem but after 10-20 seconds a dialog pops up on the phone where I have to accept the debug request
I had a similar problem, but for different reasons. My issue came from programing usb accessory on android, which changes the vid/pid when in accessory mode. The solution for me that worked was the following:
Connect the phone
Run the usb host side accessory mode commands (Example website: http://android.serverbox.ch/?p=262 )
Phone should have reconnected in accessory mode (Ensure the PID has adb: 0x2D01)
adb kill-server
sudo adb start-server (This caused the phone to re-ask auth permission)
adb logcat (In my case I wanted to watch the logs, this now worked in accessory mode)
In my case, I was using an old version of adb, make sure you have the latest version of adb. You can download here, extract and run straight within the folder ./adb.
Please go to the developer options on the phone and click "Revoke USB debugging authorization"
Enable it again and try to get the logs. This is basically waiting for the device to get connected. Make sure to authorize USB access from device as well.
In my case just change the option of USB settings from transferring files to MIDI
Enable USB debugging in Developer options
Set File Transer in USB Preferences
did the trick for me! also running adb as sudo might help.
In my case I was using a device connected with Ethernet that runs Android, and I did these steps to solve the problem.
Before, make sure OTG is on.
$ adb kill-server
$ adb connect [your device IP]
I accepted the connection request on the pop-up that appeared on the device
$ adb devices: to check that the device is connected
$ adb logcat
Android emulator is so slow that it is not possible to test run applications. Is there anyway to debug/run applications on real phone with IDE instead of emulator?
You can generally switch on USB debugging on your handset and connect it up to your PC over USB. The handset will then appear to adb in the same way as an emulator. You might need to download drivers from your handset manufacturer for your phone.
On my HTC desire the setting is under:
Settings -> Applications -> Development -> USB Debugging
Enable USB-Debugging on your phone. Connect it to your computer. ADB should recognize it and you can use it the same way as a virtual device.
If ./adb devices lists your phone as a lot of question marks, then it is lacking some permissions. To fix this, restart the adb server as root. Something on the line of:
~$ ./adb devices
List of devices attached
emulator-5554 device
????????????? device <--- your phone
~$ sudo -s
~# ./adb kill-server
~# ./adb devices
List of devices attached
emulator-5554 device
1232345345345 device <--- your phone
I realize the context is for Windows, but I had the same issue on Linux (Fedora). Creating a new file in /etc/udev/rules.d/ was necessary (and restarting adb as Hyperboreus indicates).
This is indicated clearly at http://developer.android.com/tools/device.html.
fwiw
For Windows Users:
1. Go to Command Prompt
2. Type cd /path/to/adb.exe
3. Type adb.exe devices
4. Type adb.exe kill-server
5. Type again adb.exe devices
If you get your Device, Its fine. If not, Try once again.
I have a zenithink zt-180 tablet connected to my usb port. I can use adb (from the command line) to get a shell command, reboot the tablet, and stuff like that, though I do have to kill and start the server first on the initial connect.
I can also run ddms and it shows me the device threads and statistics and so forth for the tablet.
However, whenever I try to load the helloAndroid example adb and ddms hang. To recover I have to cntr-C out of them, kill the server and then start the server. I can then do the above stated operations, just not load. In Eclips I get an error saying "failed to install HelloAndroid on device 0123456.... : timeout when i try to debug on the device.
I know the application can run because I loaded it onto a USB stick and installed it on the tablet. It ran fine.
What is it about the load program command that is hanging up adb???
Note: USB debugging is enabled in the device. I make sure that only one DDMS and adb are running. All eclips components and the USB driver were loaded two days ago. The tablet is running android 2.1.1
So I did not really fix this but I did find a work around and it's better then USB cable.
Connect to the tablet via the USB cable and issue the adb command "adb tcpip 5555". This command executed and did not crash my adb server. This is key.
Next use the connect command to connect via tcpip.
adb connect :5555
I had firmware 1030 on the ZT-180. Note: I did not have to install adbwireless and I did not have to root it.
credit to the person who came up with these directions: http://www.slatedroid.com/index.php?topic=4316.0
Thanks to all who tried to help
I have had this same effect from a defective USB cable. adb connected just fine, got the prompt on the phone to trust the computer, the device showed up as online when listing adb devices, but any attempt at install whether from the IDE or from the command line caused adb to just hang. Try a different cable.