This happens during STS testing。
run sts-engbuild -m CtsSecurityTestCases -t android.security.cts.StagefrightTest#testStagefright_cve_2019_2334 -o -d
After the device reboot,using adb devices, the console shows a small face. And we can not do sts again. We find that STS test tool can not find the devices.
connect to the device with adb shell and run: 'getprop' to find a list of properties.
Then look for the one with a smiley face :)
Could be something like: persist.usb.serialno or maybe some other property in the most recent version.
Either way, someone in your test is likely changing it, so you should then analyze who is updating the property.
Related
I am trying to set-up a command in Android studio that would allow me to see the current active devices like in this tutorial (1:39:41):
I have opened the environment settings and created the variable adb devices like it was explained in the tutorial
However, when I run it in Android Studio Terminal, the command is not recognised:
What did I do wrong?
The problem is with your naming. Try remove the white space and it will work.
Cause you type adb with argument devices.
Try change your variable to adb
then type
$ adb devices
and it will work
Has something changed that commands like the following below no longer work on Android O?
adb -d shell "run-as package.name cat /data/data/package.name/databases/foo.db" > foo.db
Running:
Build: OPP2.170420.019
Device: Nexus 6P
I have tried endless amounts of ways but even cat or cp to the /sdcard does nothing. I am guessing some permission has changed and we can no longer use run-as package.name.
The only way that I am able to get data from my non-rooted Android O device is to use a FileProvider and copy to the /sdcard.
Does anyone have success using run-as on a debug package? Anyone having the same issues as I am?
I don't know the answer to my specific question but want to share my new findings (maybe obvious to some).
After testing Android Studio 3.0 Canary 1, there is a new Device File Explorer that allows easy downloading and even syncing the latest DB!
This is such a powerful feature for anyone that needs to grab files of any sort from their devices in development. The cat command was never perfect and always screwed up the DB every once in a while.
This File Explorer + SQLPro for SQLite is gold for any Android Development that has a DB!
Will leave the question open in case someone does have a reason or solution to my original problem. Plus I would feel like a douche accepting my own answer. :)
Looks like run-as will set current directory to /data/data/packageName.
I think the following would work:
adb -d shell "run-as package.name cat databases/foo.db" > foo.db
I am new to Android development. I have been going through the tutorials.
I would like to know which is the right way to debug / log an application during its execution. I am guessing I should be able to execute my application directly on my android device and be able to view a log or so to catch runtime errors and logs?
How could I accomplish this ?
I am using this to install the application on my phone
adb install <path to apk>
p.s. I am sure this question might seem like something I should already know. But I could not figure it out :) Hence I am here :)
You can build on the command line with ant. See this guide.
& install it by using adb on the command line.
adb install MyApp.apk
path of apk with file extension
update
for getting logcat or crash report
do this way:
adb logcat
note: make sure only one device is connected to adb bridge
for filtering:
check this & this.
We have a step in our Jenkins build script that attempts to uninstall some unit tests from a device using a command that looks like this:
adb uninstall com.company.test
If the physical device that we normally have connected to our build machine is not present or off for some reason, the build will just hang saying:
waiting for device -
Does anyone know how to work around this? I've heard rumors of some plugin? Ideally, we'd like it to just spit out a warning after some timeout period and then just continue. Next most ideal would be to fire up an emulator instead.
It's not ideal, but the Build Timeout plugin will at least keep the build from hanging forever: https://wiki.jenkins-ci.org/display/JENKINS/Build-timeout+Plugin
A hacky workaround is to check if the 'adb devices' command returns anything other than the "List of devices attached" string.
In your script, try adding:
DEVICE_PRESENT=`adb devices | tail -n 1`
if [ -n "$DEVICE_PRESENT" ]
then
echo "A device is present..."
# Run your uninstall and other commands you need the device for here
fi
The only reason this hack works is that 'adb devices' currently returns "List of devices attached" and an empty line (if there are no devices found). If this behavior ever changes then this approach will no longer work.
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