Difference between adb "install" command and "pm install" command? - android

What's the difference between installing an app using the install command and using the package manager's pm install command? Do they do the exact same job? Does one command actually call the other in the back?
adb install -r APK_FILE
adb shell pm install APK_FILE

adb install is a command to run from a development host, which uploads a package somewhere temporary and then installs it.
pm install is a command to run locally on the device.
adb does indeed utilize the pm program on the device - see the source code at
https://android.googlesource.com/platform/system/core/+/kitkat-mr2.2-release/adb/commandline.c

Related

How to install an app via adb wifi connection?

I have an MXQ-4k Box TV and I need to install an app by adb wifi connection since my pc doesn't recognize the USB connection. I can access the device via adb connect ip:5555, but when I try to run adb install , the output is:
Performing Streamed Install
adb: failed to install app.apk: Failure [INSTALL_FAILED_INTERNAL_ERROR]
There is some way of calling the adb install with the path of some application installer locally at the device, e. g. adb install 192.168.15.5:/storage/emulated/app.apk?
Try this:
If you have a sdcard, otherwise change the target path:
adb connect ip:5555
adb push your.apk \$SECONDARY_STORAGE
adb shell pm install -t -r "\$SECONDARY_STORAGE/your.apk"
adb shell "rm \$SECONDARY_STORAGE/your.apk"
You also can try adb install -t "your.apk" and see if it helps.

How to install .apk into android device programatically?

Can anyone help in how to install .apk file in the android device/emulator programmatically?
I have tried the below methods:
UiDevice mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
mDevice.executeShellCommand("adb shell pm install -t -r /data/local/tmp/com.example.xxxxx.xxxxxx");
But it is not working.
I am using UIAutomator for android native app automation testing, I need to install .apk file into android device/emulator before proceeding with my test scripts execution.
executeShellCommand runs inside your device. No need adb shell again.
UiDevice mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
mDevice.executeShellCommand("pm install -t -r /data/local/tmp/com.example.xxxxx.xxxxxx");
You can use the code below to install an application from the command line
adb install example.apk
Before execute `adb shell pm install`, run "adb root" command firstly.
if you rooted the device, this step could be omitted.

How to install .apk file using adb on nixos?

I'm running nixos and I have a .apk file, i.e. an Android app.
There is the handy tool adb (Android Debug Bridge) and the command
adb install /path/to/app.apk
How do I get it to work on nixos?
The binary adb is in androidsdk. So either run
nix-env -i androidsdk
or add androidsdk to the list environment.systemPackages in /etc/nixos/configuration.nix.
Your Android phone needs to be plugged in and have USB debugging enabled as documented on developer.android.com.
Simply running adb install ... didn't work for me. Instead I did
sudo adb start-server
adb install /path/to/app.apk
or
adb install /path/to/app.apk -r
for overwriting an already installed app.

Unistall app from shell using ADB

I've connected the smarthpone (rooted) to the PC (Linux) with ADB.
Eveything works fine excepts the fact that I can't unistall apps from shell. I've tried :
adb unistall com.mirsoft.passwordmemory
adb unistall -k com.mirsoft.passwordmemory
And I get the help message as return.
I've also tried:
adb shell pm unistall com.mirsoft.passwordmemory
adb shell pm unistall -k com.mirsoft.passwordmemory
Getting as return
Error: unknown command 'unistall'
followed by the help message.
Other commands works fine.
Am I doing something wrong?
uninstall has an n after the i. Use adb uninstall com.mirsoft.passwordmemory.
You can also try to uninstall with the rm command:
adb shell rm com.mirsoft.passwordmemory
Don't​ forget typically the su command to grant the super user permissions.

Frida - list Android processes

This question is about the security framework, Frida. On the target Android device, why can't my Frida-Server [which is loaded onto the Android device] list the running processes?
$ frida-ps -U returns only the Frida-Server process ID and strangely, adb.
I am running Android 4.4.2 (32 bit O/S).
The device is rooted.
I updated the version on my host machine (not target app):
$ sudo easy_install -U frida
I setup the very latest Android Frida server on device dies.
$ curl -O https://build.frida.re/frida/android/arm/bin/frida-server
$ adb push frida-server /data/local/tmp/
$ adb shell "chmod 755 /data/local/tmp/frida-server"
$ adb shell "/data/local/tmp/frida-server &"
I could list the process ID of my app on the target Android device:
$ adb shell ps | grep myapp
I killed my Frida Server on the Android device and restarted it:
$ kill -9 <process id>
When I try to attach directly to the process ID $ frida -U <process ID> I get a permission denied message.
Two clues helped me solve this. The fact I could see
The adb process.
I was getting a permission error when trying to execute $ frida -U <process ID>
The answer was to adb shell into the target Android device and do a Change Ownership (chown) on the Frida-Server.
When I installed it, the Frida-Server was installed as the owner Shell. When I changed the owner to Root, all my processes listed fine on my Mac when I ran: $ frida-ps -U
The chown command was:
/data/local/tmp # chown root frida-server
Use adb root before you try and install the Frida Server on the Android device.
It is because your frida-server has not enough permission
Make sure frida-server run as root, then you can list all processes
Try to do these:
1. copy frida-server to device
2. run as root on your device, and start frida-server
3. with usb connection, and run frida-ps(client frida must be same version with frida-server)
Then you can list processes

Categories

Resources