Eclipse has multiple copies of same Android Device - android

I've been programming for Android devices for some time now and just recently came across this:
There is a single one in the list online, but I can't run/debug my programs because it reports "ADB rejected install command with: device offline" since every other device has the same ID.
A reset fixes this, but is there any other options? Why is this happening?

Exit eclipse, kill adb and restart eclipse

I find that the issue is often with a bad cable or connection. Try and insert it into another USB slot or try with a different cable, worked for me.

I had to remind myself how to call the commands, so I thought I'd write an answer for other people that don't remember how.
Find the location of adb.exe.
Open up command prompt.
In command line, change the directory to the directory from step 1.
For me, the command and directory is: cd C:\ADT\sdk\platform-tools
Run: adb kill-server from the command prompt
Run: adb start-server from the command prompt
Credits to Squeazer for the commands.

Related

Android Studio - Unable to open debugger port: java.io.IOException

I am stuck in a problem here.
I cannot attach debug using Android Studio 3.5.1.
Its keeping showing me the message "Error running 'Android Debugger (8600)': Unable to open debugger port (localhost:8600): java.io.IOException"
I tried a lot of things like:
adb reset
invalidate
restart windows
reinstall android studio
and none of them works.
And I cannot find Enable ADB Integration on this version.
Anyone knows how to fix it?
EDIT
Debugging with emulator is working with all versions.
Debugging with devices is working only with devices with Android 9.0+
Kill and start adb didn't work.
I dont think its a local problem because its happen with a lot of people here. Its seems to be a project problem
You might check this 3 things:
1.
Youre not running a not debuggable version.
android:debuggable="false" in Android Manifest
2.
In Android studio you re not building a release version
Check in Build variants in bottom left corner.
3.
If nothing works use Troubleshoot device connections
Tools -> Connection Assistant
or older version
Tools -> Troubleshoot device connections
And try out the helper page from google (seems for older versions)
https://developer.android.com/studio/run/device#assistant
Try this:
adb kill-server
adb start-server
adb usb
For linux, e.g., ubuntu: start all commands with sudo like this:
sudo adb kill-server.
its your connection issue, cant find your device DNS.
what is your OS ?
In windows:
you must go to network and find duplicate dns and clear it (Search for
it)
In mac:
you must kill adb or delete that and run a new version
last hit is Update emulator in sdk
.First you need to check your build.gradle(app) file , and ensure that your build is debuggable.
.If debuggable then you need to check adb is working or not in your system, you can
check by just press 'adb' .
if its working then check devices by 'adb devices', it will show all connected devices.
add kill-server then enter and adb start-server
Try this. I have had luck with this approach when I run into problems with adb.
You can check if the device is recognised or not using
adb devices
If it is indeed recognised you may try to kill adb and start it again
add kill-server
adb start-server

Android ADB devices unauthorized

Configuration:
Windows 8.1
ADB version: 1.0.32
Smartphone: Oneplus One
Problem
I installed the Samsung drivers as it is said to do. When I run the ADB devices command, it said unauthorized.
Already tried:
I've done everything that'd been said on this post: https://stackoverflow.com/a/25546300/1848376
But the problem is that I don't get a prompt on the phone to tell me I must accept the connection.
When I run the command adb shell, here is the answer:
error: device unauthorized.
This adbd's $ADB_VENDOR_KEYS is not set; try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
I did "adb kill-server", but it didn't change anything. Why?
Try Revoke USB DEBUGGING Authorization.
Enable USB debugging again.
It worked.
Thankgod xda developers exist : http://forum.xda-developers.com/verizon-lg-g3/help/unable-to-access-adb-t2830087
Just had to delete adbkey file in C:Users/$Name/.android adbkey.pub was missing.
Restart after this and both files are there.
If this does not work :
- Try Revoke USB DEBUGGING Authorization.
- Enable USB debugging again.
In sequence:
adb kill-server
in your DEVICE SETUP, go to developer-options end disable usb-debugging
press REVOKE USB debugging authorizations, click OK
enable usb-debugging
adb start-server
I removed the following files from the ~/.android folder:
adbkey
adbkey.pub
I disabled and enabled ADB within device and now it works...
in Developer options,
Enable USB debugging.
Give a authorization.
(if there is no a Developer option menu, you have to click 3 times build number of Phone State menu to be developer. you can sse a developer option menu.)
Delete existing adbkeys
OR
Rename adbkeys
Best practise is to rename the keys because it provides backup.
cd ~/.Android
mv adbkey adbkey2
mv adbkey.pub adbkey.pub2
Next stop & start the server
cd ~/Android/Sdk/platform-tools
Locate the device
/Android/Sdk/platform-tools$ ./adb devices
/Android/Sdk/platform-tools$ ./adb kill-server
/Android/Sdk/platform-tools$ ./adb start-server
Then, stop the emulator Open AVD manager, click on the down arrow, then click on wipe data
Restart the emulator. Then everything works fine :)
This worked for me
1- Go to ~/.android/ and remove “adbkey”
2- Disconnect USB connection
3- adb kill-server
4- Revoke USB debugging authorizations (in developer option)
5- Reconnect the device to the Ma
6- adb devices
Try this uncheck the "verify apps via USB" in developer options and then turn on and off the "USB Debugging". It works with me.
Ensure that you have accepted the pressed the "ok" button when it is asking it is showing the fingerprint of the device after connecting through usb to your PC.
In Android studio, Run menu > Run shows OFFLINE ... for the connected device.
Below is the procedure followed to solve it:
(Read the below note first) Delete the ~/.android/adbkey (or, rename to ~/.android/adbkey2, this is even better incase you want it back for some reason)
Note: I happened to do this step, but it didn't solve the problem, after doing all the below steps it worked, so unsure if this step is required.
Run locate platform-tools/adb
Note: use the path that comes from here in below commands
Kill adb server:
sudo ~/Android/Sdk/platform-tools/adb kill-server
You will get a Allow accept.. message popup on your device. Accept it. This is important, which solves the problem.
Start adb server:
sudo ~/Android/Sdk/platform-tools/adb start-server
In Android studio, do Run menu > Run again
It will show something like Samsung ... (your phone manufacture name).
Also installs the apk on device correctly this time without error.
Hope that helps.
None of the methods listed on this page worked for me; specifically:
I had an issue where the Settings app would crash when selecting Revoke USB debugging authorizations
I was running LineageOS 14 x86_64
I was using ADB over network
The /data/misc/adb contained no adb_keys file
Removing my local ~/.android/adbkey did not help either
I had root access from the local terminal
I was not getting any confirmation dialog
adb: error: failed to get feature set: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
- waiting for device -
In the end, I found a very useful post here that suggested to manually put the contents of ~/.android/adbkey.pub inside the /data/misc/adb/adb_keys file.
They suggested one of these two methods:
From another working device, copy the adb_keys file into your computer:
# On the other Android device
cp /data/misc/adb/adb_keys /sdcard
# From your computer
adb pull /sdcard/adb_keys .
Then put the working adb_keys file into the problematic Android device's sdcard (using Web or MTP) named as adb_keys, then copy the file into the correct path:
# On the problematic device
cp /sdcard/adb_keys /data/misc/adb/adb_keys
The other method is to simply copy your machine's adbkey.pub from the ~/.android/ directory, and put it into the problematic Android device's sdcard (using Web or MTP) named as adb_keys, then copy the file into the correct path:
# On the problematic device
cp /sdcard/adbkey.pub /data/misc/adb/adb_keys
(Note: there's a similar answer on SO that goes into further details for this method.)
Since I was running a web server on my computer, and I had curl installed on Android, I su'ed from the terminal and ran the following on my Android device:
cd /data/misc/adb
curl 192.168.1.35:8080/adbkey.pub > adb_keys
Killed the adb daemon (using adb kill-server) and BAM! The adb shell worked fine, like it should have been from the beginning.
Hopefully, the method described here works for you as it did for me.
First Remove the adbkey and adbkey.pub from the .android directory in your Home directory.
Make .android directory in your home with 710 permissions: $ chmod 710 .android/ and ownership as: chown -R <user>:<user> .android/. Ex:
$ chmod 710 .android/
$ chown -R ashan:ashan .android/
Go to developer options in your mobile and tap option Revoke USB debugging authorizations
Turn off all USB Debugging and Developer Options in the device and disconnect the device from your machine.
Connect the device again and at first turn on the Developer Options. Then Turn on the USB debugging.
At this point in your mobile, you will get a prompt for asking permission from you. Note: you must check the checkbox always accept from this …. option and click ok.
Now in you machine, start the adb server: adb start-server.
Hopefully when you issue the command: adb devices now, you will see your device ready authorized.
I was hit by this problem, too. I'm using my custom build of AOSP on Nexus 5X. I've added a single line in build/core/main.mk:
diff --git a/core/main.mk b/core/main.mk
index a6f829ab6..555657539 100644
--- a/core/main.mk
+++ b/core/main.mk
## -362,6 +362,8 ## else # !enable_target_debugging
ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0
endif # !enable_target_debugging
+ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1
+
## eng ##
ifeq ($(TARGET_BUILD_VARIANT),eng)
Now adb shell works fine
Those materials are useful (Chinese articles): http://www.voidcn.com/blog/kc58236582/article/p-6335996.html, http://blog.csdn.net/fanmengke_im/article/details/28389439
Try deleting the adbkey file from C/.android folder
and then run the commands as
mentioned above i.e.
adb kill-server, adb start-server and adb devices
.
Your app is being detected as some harmful program.
Turn off "Verify apps over USB" option. It's in the same view as "USB debugging".
All you need is to authorize debug mode.
1. make sure your Device is connected to your PC.
2. Allow authorized for debug mode via Android-Studio by going to
Run -> Attach debugger to Android process
than you will see the pop up window for allow debug mode in your Device, press OK. done.
i hope it help to someone.
I had the same problem after reinstalled my android studio. Here's what I did to make my adb work again:
-path to C:\Users\User\AppData\Local\Android\sdk\platform-tools
-Shift+r.click and start command from here instead.
for anyone encountering this later this may also help. I encountered this exact issue trying to use adb from a user command prompt and the answers above did not help, but the problem went away with an "adb kill-server" when running in an administrator command prompt.
This worked for me:
rm ~/.android/adbkey.pub
sudo ./adb kill-server
sudo ./adb start-server
sudo ./adb -s emulator-5554 install ~/apk_to_install.apk
I'm not sure if is a good idea run adb with sudo privileges,but it was the only way I get it works. Regards.
I got this as root when as a non-root user I was getting permissions errors trying to connect to custom recovery (Philz). so I killed adb server, copied the .android subdirectory of my user account into /root, chowned -R to root.root, and restarted adb server. I'm in!
Disconnect USB between PC and device
Stop adb server by entering "adb kill-server" in command window
On device use "Revoke USB debugging authorizations" in "Developer Options"
On PC delete "adbkey" file in user directory, for example "C:\Users\Amit\.android"
Reconnect the device to the PC
Open a command window and enter "adb devices". Watch the device's screen for any Authorization message and allow the connection.
I suppose you have enabled On-device Developer Options in your smartphone? If not you can take a look at the steps provided by Android, http://developer.android.com/tools/device.html#developer-device-options
For FIRE STICK 4K it actually says in the dialog:
Otherwise check for a confirmation dialog on your device
Indeed on the TV in the other room there was a confirmation dialog. Doh'!
I had this problem and it wasnt solved by the deleting of any keys (at least deleting them didnt fix it, maybe had an effect after i did fix it though)
I actually had a discrepancy between my sdk-tools version and my Android Studio version. After updating my tools it still didnt work, but after updating AS (to 1.4) everything worked fine again.
Always update both sdk-tools and AS version together ;)

Adb Error on "adb devices"

When I type in "adb devices", the output is "error: protocol fault (no status)". The adb functionality is broken in both Android Studio and Eclipse, so it's a problem with the connection, I believe. I tried to kill adb.exe from the Task Manager, but it's not listed in the processes. Any tips?
Try to open the this directory :
adt-bundle-windows-x86_64-20130917\sdk\platform-tools
Hold shift + right mouse click. Select open command prompt here.
After that,
in the command window type
adb kill-server
and then
adb start-server
then,
adb devices
See if the adb is started and if your device is visible on eclipse or android
studio.
My problem was my parental controls software. The adb.exe works fine with it disabled.
Same problem i faced in past, the solution worked for me is:
Navigate to the plateform-tools(it is under SDK) and execute following commands on cmd.
C:\Android\android-sdk\platform-tools>set ADB_TRACE=1
C:\Android\android-sdk\platform-tools>adb start-server
I hope it will help you
Change your USB cable then it will resolve the issue.

ADB not responding. You can wait more, or kill "adb.exe" ... windows 8

When I try to test my Android application with an android emulator as always I now suddenly get an error message. I'm working with Windows 8. So far I tried the following things which unfortunately could not solve the problem:
reinstalling eclipse with android adt
reinstalling java
installing "android studios" first solved the problem but after one day mysteriously also here adb, stopped working with the error message given in the title " ADB not responding ...
furthermore I unsuccessfully tried out some advice from Mr. Google:
Stopping adb.exe via task-manager and restarting eclipse / android studios
"adb kill-server" then "start-server" via command prompt
setting the path to adb.exe as an environment variable
switching off any antivirus or firewall
starting the IDEs as an administrator
updating the IDEs
The only thing I can remember doing which may have destroyed adb on my computer for all times: I connected my motorola smartphone to my laptop and installed the motorola usb drivers but as I said the adb also won't work with the emulator.
Any help would be kindly appreciated. The issue bothers me for more than an entire day now. Maybe someone had similar problems on Windows 8 ?
On OSX helped:
Close Android Studio
Kill all processess using 5037 port
sudo lsof -i |grep 5037
sudo kill PID_NUMBER
Run adb devices from console
adb devices
Meanwhile the emulator is working again. I cannot definetly say what solved the problem. What It could be a combination of two things:
Deleting the hidden ".android" folder under C:\Users...
(Probably there was some malfunctioning automatically created code)
Deleting and recreating the Path variable to the folder with adb.exe ( ...\sdk\platform-tools\;)
Finally it could be a Windows 8 issue which I don't understand.
Try this,
Open a command prompt with administration permission and type
netsh interface tcp set global autotuninglevel=disabled
This worked for me
Edit: Windows only
Kill the adb.exe with a command prompt. Open a command prompt were your adb.exe is located and type
adb kill-server
Maybe HTTP Proxy blocked the localhost 127.0.0.1:5037
If you have config the HTTP Proxy, make sure to exclude the localhost like picture below
Also, port can also be blocked by the firewall and anti-virus firewall, please notice as well.
Try this,
at the prompt try adb kill-server
Start one of your AVDs
at the prompt try adb root
The prompt should say adbd is already running as root.
That should fix it.
In case it helps anyone else, for me the problem was related with the USB hub that the tablet was plugged into on the computer (unplugging the webcam which was in use fixed it).
I got the same error. Don't worry. I have an solution. Go to Task Manager. Kill the process called adb.exe. You will find 2 or 3 processes. Kill all of them. You are done. It will work.
I have the same problems. Verify port 5037 is free and ports 5555 to 5585 are available and never used by another process.
"ADB server sets up connections to all running emulator/device instances. It locates emulator/device instances by scanning odd-numbered ports in the range 5555 to 5585"
FROM: http://developer.android.com/tools/help/adb.html
To find out which process is listening on a port on Windows yo can use:
C:> netstat -an -o
FROM: How can you find out which process is listening on a port on Windows?
I had the same problem, here is my simple fix:
-Go to task manager in windows, look for adb.exe, and kill it
-Go to command prompt, and tap adb devices ==> it will automaticaly start adb daemon
I finally just restarted the computer, and that solved the issue for me.
Uninstall HTC Sync. Or disable it somehow.
Try to open adb from command prompt from directory location as <sdk>\platform-tools,
If adb file is missing try to re-install Android SDK with latest version,
And try to run again..
I think issues will solved, by this procedure.
I saw this on a Mac OS X.
I shut down Android Studio and ran adb get-state in the terminal. When I started Android Studio back up, the warning had gone away.
BTW, I did just try restarting Android Studio without any luck. I am sure a restart of OS would have fixed it too.
The same thing with the Asus Sync utility (with the both our Transformer's 700 and 701).
I think there is a USB-port conflict between ABD driver and Sync utility.
Exit from Sync utility resolve the problem.
Looks like this could be caused by a bunch of different issues. This just happened to me because I had my android phone device plugged in for USB debugging, then after a few hours (and multiple android studio/phpstorm restarts) I had to do unplug the device manually. Things started working again after unplugging.
I have faced this problem few days ago. When I opened my task manager it showing me two adb runnig. It may be because of I am using mobogenie for connecting my android phone for debugging application. This problem is because of moboginie and adt port conflict. then I have followed following procedure to sort out this issue.
!) close eclipse
2) Go to task manager and kill all adb processes.
3) Now go to platform-tools in android sdk
4)press shift+right click mouse and select "open command window here" option
5) type
adb kill-server
adb start-server
6)if server sucessfully started then start eclipse and then connect your phone
(Remember dont connect your phone before starting eclipse)
Following works for me every time:
go to File->Invalidate Caches/Restart
select Invalidate and Restart
And, You are good to go.

Eclipse ADB error [Ubuntu 13.04]

So I'm running Ubuntu 13.04 and for the past many hours I've been trying to get eclipse (Eclipse Juno 4.2.2) to launch anything on my phone, or even just in the emulator, but to no success. Whenever I try to launch the app, I'm greeted with an adb not found error (/home/kiyoshi/Desktop/Development/Android/sdk/platform-tools/adb not found), even though I have checked multiple times to make sure a file named adb is there.
I have also installed adb via command line so using commands such as 'adb devices' works fine, and I really have no idea what I'm doing wrong, even after looking through pages of other questions with similar problems.
This screenshot shows the error when I try to launch anything
Any help is appreciated,
thanks!
The error message clearly states something different: "libncurses.so not found". So you probably missed to install the needed 32-bit stuff:
sudo apt-get install ia32-libs
Make sure your device is in USB debugging mode. Then, restart the adb server by the console, going through is path and typing:
adb kill-server
then
adb start-server
Restart Eclipse and usb connection (unplug, plug)
hope it helps, it Always helps me

Categories

Resources