When multiple android devices are attached, but only one of them is in debug mode, adb install|shell|... will fail with
error: more than one device/emulator
Obviously, that issue can be fixed by specifying the serial of the online device, either via ANDROID_SERIAL or a -s parameter. For fixed build scripts under version control, it would imho be better to just use the only possible device if there is only one.
Why does adb take offline devices into account? Is there a way to change that behavior?
Note: I'm searching for pure adb answers; I'm aware that I can script a call to adb devices extracting the serial of the only device, if any. But it just feels wrong for such a simple issue...
Related
Suddenly my "adb pull" command will stuck in the middle of the process.
I'm not sure what cause it, after install some application or driver.
Happens for Pull one files or multiple files.
Does anyone encounter the same issue before? thanks.
Example:
U:\batch>adb pull /sdcard/xxxlog/mobilelog .\xxxlog\
[ 94%] /sdcard/xxxlog/mobilelog/APLog_xxx/main_log_1__xxx: 87%
Here a screenshot from my console
for my specific answer, and provide a possible answer to who encounter similar problem.
after I reinstall the whole os, testing different adb version,
the issue still remains.
during testing adb version,
I found the issue will not happens if i use Local Disk...
where issue happens when using Network Drive..
So a possible solution, is don't use Network drive
I encountered similar problem on adb server (v 1.0.40) started on Windows 7 machine. When tried to pull files from device on other machine running Linux in same local network (I used: "adb -H pull ...") the adb was freezing occasionally.
The solution was to not use Windows for ADB server.
This problem was NOT visible, when adb server was running on Linux VM (Ubuntu 16.4/ VirtualBox). Hope that this helps.
BR,
Ziggy
Every time I encounter this, it ends up being a max path length issue. Open a shell on the device using adb and review the file names within the directories that you are pulling. If any have exceedingly long names, they will silently fail and adb will hang
The thing that really throws you for a loop is that it usually fails after giving a percentage complete which makes you think it's a faulty connection or some other issue.
I haven't found a good way to recursively list out file names in shell and test their name length prior to doing the pull in order to know that the issue is going to happen, but when I have the same issue and rename long files, it ends up working on the next attempt.
I encountered the same problem when trying to transfer a large amount of data from an Android phone to a Raspberry Pi 3B+, and the logcat output seemed to reveal that adb was silently failing due to an issue with USB buffer reads (unfortunately, I don't have the exact message with me).
After the initial failure, it was possible to get another few files individually by unplugging the phone, running adb kill-server and adb start-server, and plugging it back in between each one, but the only longer-term fix I could find was restarting the Raspberry Pi. This solution, however, is not permanent, and must be repeated occasionally.
I was not able to replicate this issue on Windows or on a traditional Ubuntu system.
I encountered this problem while copying files from My Ubuntu machine to my Pixel 7.
A workaround based on this bug report, is to run
adb shell exit
in another terminal whenever it gets stuck until all files are copied. You can also run
watch -n 30 adb shell exit
to run the command every 30 seconds so you don't have to keep watching the process. I hope this helps someone.
I understand that this question has been asked 1000 times but every answer I can find on Stackoverflow and other websites are all the same: Either (1) The user is using Genymotion, (2) the user is using HTC Sync in Windows.
I am doing neither. I am currently running in OS/X (10.11.6) and am using a Moto X (2nd gen) phone running Android 6.0.
Many times (not every time) when I run "adb logcat", I get
adb server is out of date. killing...
* daemon started successfully *
This is a problem because I am trying to run some automated tests using gradlew (since using "adb shell am instrument" doesn't produce the JUnit style report I need) and collect logs... but every time I start "adb logcat", something in gradlew (apparently) tries to startup adb, which then kills all running instances of adb.
Has anyone seen this problem without using Genymotion/HTCSync/Windows and knows a solution?
Thanks!
The root cause of the server is out of date issue is still the same regardless the OS and/or other software used - you have multiple copies of adb binary in your system. And the solution is also the same:
kill all running adb processes
make sure you have the only copy of adb (remove the duplicates)
update it to the latest version
reconfigure all your software packages to use that copy
Just check that every tool you use is using the same adb version. For example, delete all versions except the latest.
Please check all your environmental paths which ADB has.
Your system may have several ADB.exe files so that mismatches makes the issue.
Today i bought the Samsung Galaxy Note 3 which came with Android 4.3. Since it's so new, i couldn't find a way to root my device, so instead i tried with the adb connection ... i failed.
So, i used this
D:\android\adt-bundle-windows-x86-20130219\sdk\platform-tools>adb push g:\save15.dat /data/data/com.creativemobile/dragracing/files/
but i got this
failed to copy 'g:\save15.dat' to '/data/data/com.creativemobile/dragracing/files/': No such file or directory
so, is there a way to copy my file to my device?
It should be
adb push g:\save15.dat /data/data/com.creativemobile.dragracing/files/
If you're allowed to push files/data there it will work.
you can use the
adb restore command for android 4.x.x
but you need to have an adb backup before.
but i think adb shell backup command does not work for android 2.x.x
maybe this will work for you
http://dragracingforum.net/viewtopic.php?f=262&t=13477
if not then you can ask the the post author i think he knows how to.
There's a bug in 4.3 that prevents this from working on a real, non-rooted device. https://code.google.com/p/android/issues/detail?id=58373
Yes, the following works on my limited edition nuclearsx-sp5
type these commands
adb reboot
adb remount
adb root
This is tested to work only on "improperly" (YES! I mean it) rooted devices which are known to have production builds. But it works on my samsung galaxy wonder (non-rooted)flawlessly.
Good luck!
I need to copy on a sqlite DB file onto the android device. Along with other files.
This is to be done by a delphi App. Ofc I can pull up console commands.
So basically, Can I copy to and take files from the devices.
Now, I have adb option.
C:\Users\Documents>adb devices
List of devices attached
4527103425FC4D7 device
HT25ZW127890 device
C:\Users\Documents>adb push -s HT25ZW127890 test.txt /sdcard/test.txt
But no idea how to target my device. It just lists all the options as if i typed in adb. And with out the -s bit, it says multiple devices attached.
What am I doing wrong? Plus...
Also: This is adb -> Android Debug Bridge. Which needs Debug mode set.
Surely this isn't the ideal way for a realised application, needing the phone in debug mode.
http://developer.android.com/tools/help/adb.html
This text suggests you have wrong positions for "-s" and "push" keywords.
The usage is:
adb [-d|-e|-s <serialNumber>] <command>
I'm planning to build an automated system for deploying an Android build to various devices, in order to make development for multiple platforms a bit more comfortable. Is there a way to get the sdk version of a connected device through android shell or adb?
There will be a computer to which several test devices is connected, and I was planning to write a script which will fetch the correct build for each of those from a build-server, install the different apks on their respective devices, launch them and collect log info, to be made available through some other program whose specifications are beside the point.
The point is that I need to know the sdk version each device is running to install the correct apk, and I was hoping I could get this through adb, but I can't seem to find a way to access it short of building a tiny app, compatible with all versions, whose sole purpose would be to output android.os.Build.VERSION.SDK or similar somewhere my script could read it.
you can use this command:
adb shell grep ro.build.version.sdk= system/build.prop
It will output something like this:
ro.build.version.sdk=10
adb shell getprop ro.build.version.sdk
Note #Tim: this works even on phones without grep support on all host OS :-). (i.e. on old phones where toolbox does not support grep you you need to have busybox on your phone).
I also discovered a way to get the exact version of Android e.g. 4.2.2 based on the following web article http://xayon.net/looking-for-android-version-with-adb/ You need to be using a unix-like operating system - Linux and Mac OSX are fine, and windows users can use cygwin or equivalent.
At a command line:
echo version=$(adb shell getprop |awk -F":" '/build.version.release/ { print $2 }')|tr -d '[]'
Here is the result for my Nexus 4:
version= 4.2.2
I think you can by accessing the device with adb shell - change directories to position you at system and do a cat of build.prop. Here you will find for instance, ro.build.description=google_sdk-eng 2.2, ro.build.version.release=2.2 etc