I am trying to copy a file from my device to my desktop using the following adb command:
adb shell run-as peachss.test.inspect pull /data/data/peachss.test.inspect/files/Inspection.2.xml %USERPROFILE%\Desktop\
But it just say that Package 'peachss.test.inspect' is Unknown, but I can see that it is installed on the device
Edit 1:
Forgot to mention, I am using the S4-Mini with Android 4 or 4.4
Its a recognized Android bug.
More info here and here
The issue is related to the use of "run-as", not "pull", is it totally needed for what you want to achieve?
Hope this help.s
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 have just learnt using preferences in Android. For debugging purpose I need to access the preferences files. I googled and found the default location of the preference file and also how to access it via Android Device Monitor.
Somehow I am not able to open any folders under the File explorer tab of the Android device monitor. They just aren't responding. I tried waiting for ADM to load and tried again but no success. (Double click on folder is not working, STRANGE!)
Do we need to configure before using it? I am using Android studio.
Any help would be appreciated.
Attaching image
Finally I found how to make it work.
goto run -> location where your adb is
Ex: C:\Program Files (x86)\Android\android-sdk\platform-tools
type adb root , Enter (Your phone must have root)
If this doesn't work, install this app on your phone: [root] adbd Insecure or its free alternative here (update: link broken now).
Get more info at http://forum.xda-developers.com/showthread.php?t=1687590
You will need either to use the emulator or to have a rooted phone to use all functionalities.
Root your device and open adb shell and change the permissions as:
$ adb shell
$ su
1|root#android:/ # chmod -R 777 data/
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
I want to write a small tool to move apps to SDcard.
I found the movePackage()-method in Android Open Source and reflect the method. I failed because this method need com.android.PERMISSION.MOVE_PACKAGE which I cannot get. So I want to using shell script to do this for rooted devices.
But I don't actually know what happened in the movePackage()-method. So I can't write the correct script.
Could you please tell what happened inside the Android when a app is moved to SDcard? Can I do this with program?
I'm not sure If I understand you, but on rooted device you can use adb.
For example:
adb push /home/username/Desktop/app.apk /sdcard/app.apk
Also you can do this (for removing):
adb shell rm /sdcard/app.apk
If you want to install:
adb install /home/username/Desktop/app.apk