Where is the deployed apk file? how to uninstall it with adb? - android

I have tried to install my apk using adb like this:
D:\C_Desktop\Development\Android SDK\platform-tools>adb install "C:\test_haxe\bin\android\bin\bin\testhaxe-debug.apk"
4274 KB/s (3702929 bytes in 0.846s)
pkg: /data/local/tmp/testhaxe-debug.apk
Success
so, its installed fine, but at my phone, I couldn't find the apk file, is it deleted after being installed?!
also, I tried to uninstall it like this:
adb uninstall com.ketab.haxe
but I get
Failure
Because I have no emulator, I will have to install the app each time to see the progress, so I will need to uninstall it and then install the new app on my phone, is this the right way to go any way?

to find out the apk file location after installation use pm path <package> command:
adb shell pm path com.ketab.haxe
you could try uninstalling the package with:
adb shell pm uninstall com.ketab.haxe
in case of failure check the error message with:
adb logcat -d -s PackageManager:*

Linux/mac users can also create a script to uninstall ("delete") an apk with something like the following. Create a file named adb-uninstall with these 3 lines:
pkg=$(aapt dump badging $1|awk -F" " '/package/ {print $2}'|awk -F"'" '/name=/ {print $2}')
adb uninstall $pkg
Then chmod +x adb-uninstall to make it executable.
now you can simply:
adb-uninstall myapp.apk
The benefit here is that you don't need to know the package name. Similarly, you can create adb-run myapp.apk.
Note: This requires that you have aapt in your path. You can find it under the new build tools folder in the SDK.

[with solution] I couln't find the apk file on my android device after installing successfuly from the command line my app apk (adb install ~/Downloads/myapp.apk) . After searching my phone's File Manager, I found out the app was downloaded as an APP and not as an apk file, as I had expected.
So if anyone else was looking for the apk file - it's an application and not a file you can see

Related

Adb error while pulling an apk file from android device [duplicate]

I try to get the APK file of installed app on my Android phone, I followed this answer which says no need for root access.
I know Facebook app package name is com.facebook.katana, I see it with command adb shell pm list package.
Then, I tried in command line:
adb shell pm path com.facebook.katana
It returns:
package:/data/app/com.facebook.katana-2/base.apk
Then, I pull the apk file to my computer by:
adb pull /data/app/com.facebook.katana-2/base.apk
But output is:
adb: error: remote object '/data/app/com.facebook.katana-2/base.apk' does not exist
Why I can not get the APK but that answer says it works?
Pull the APK file from the Android device to the development box by setting destination path.
adb pull /data/app/com.facebook.katana-2/base.apk path/to/desired/destination
or use,
adb shell cat /data/app/com.facebook.katana-2/base.apk > app.apk
Insted of
adb pull /data/app/com.facebook.katana-2/base.apk
Use :
adb shell cat /data/app/com.facebook.katana-2/base.apk > app.apk
And your apk will be generated inside Your_Android_SDK_path\platform-tools
Install MyAppSharer from Google Play on the phone, run it, find your desired app, share it to your Google Drive (or email if file is small enough).
Works on Android 7.1, where the above adb pull commands don't work (at least not for me); says app doesn't exist. So just use the app, no need to run adb commands.
Try using adb pull to download a specified file from an emulator/device to your computer.
adb pull /data/app/com.facebook.katana-2/base.apk target/path

Error installing (arcore-preview.apk) via USB/debugging mode on an Android Smartphone

I was following the instructions given on this https://developers.google.com/ar/develop/java/getting-started Google Developers Website but when I tried to install the APK file on my Android Device via Terminal (macOS)
Terminal gave me this error:
$ adb devices -l List of devices attached 93eafadd device usb:336592896X product:kenzo model:Redmi_Note_3 device:kenzo
$ adb install -r -d arcore-preview.apk Invalid APK file: arcore-preview.apk Sayans-iMac:~ sayan$
So I even transferred the APK to my Android device and tried to install it in the Android device it self manually, but I got this error: error parsing package!
I don't know why this is happening and I have also enabled USB debugging!
I had this same problem, but had not pointed adb to the right package:
adb install -r -d ~/Downloads/arcore-preview.apk
"Your download directory might vary."

Batch file to run an Android app in emulator

compile.bat:
set PATH=%PATH%;H:\Source\Program\sdk\tools;
set PATH=%PATH%;H:\Source\Program\sdk\platform-tools;
cd sdk\tools
emulator -avd emulator2
adb wait-for-device
cd sdk\platform-tools
adb install -r SP.apk
Here is my batch file to run a .apk into an emulator. It is from a CD, my adviser wants to run my app in his computer using my CD. My SDK folder is also in the CD and is the same directory with my compile.bat. Is my setting of path correct? Also there is an error when I test the compile.bat from the cd, it says too many files specified; only take APK file and verifier file.
The adb install command also become like this adb install -r SP.apk apk P.apk T_ROOTPROJECT_NAME-debug.apk. I only want to install SP.apk in the emulator.
When I run the commands in cmd, not in a batch file it is working.
Also I want to know how to enable the camera in my laptop to the emulator. My app requires the camera to run.
Can someone help me please? I am begging you. I need this tomorrow its for my graduation. Thank you.

Can't install apk via adb, file DNE despite showing up using adb shell ls

I uploaded an apk using adb
adb push myAppName.apk /sdcard/
to double check:
adb shell ls /sdcard/
sure enough, it's there.
then:
adb install /sdcard/myAppName.apk
can't find '/sdcard/myAppName.apk' to install
Note* I tried adding the path in parentheses as suggested on an xda post but this didn't help.
Are there multiple sdcard directories where push defaults to one and install defaults to another? I tried using root explorer to find the files that adb install /sdcard/<TAB> suggests but I can't file these files in any dir.
adb install takes a file on your pc to install it. It doesn't look on the phone.
You can use:
adb shell pm install /mnt/sdcard/myAppName.apk
It will install apk from the device it self.
Please check Package Manager here.
Connect your device and the from the location where you have your app.apk do adb install app.apk . It will install it to your device.

adb uninstall failed

I am writing some sample apps.
After I debug these apps, I don't see an uninstall button in my device's application management.
When I do adb uninstall, it always says Failure without any reason.
In DDMS I saw that my apk is stored in /data/app/com.k2g.leaveDemo-1.apk.
I am not sure what am I missing.
I always have to reset my device to get rid of these apps :(
Do I need to do sign something?
Do I need to do something in debug mode?
Or does it depend on the version?
I am using Samsung S2.
I assume that you enable developer mode on your android device and you are connected to your device and you have shell access (adb shell).
Once this is done you can uninstall application with this command pm uninstall --user 0 <package.name>. Where 0 is ID of main user in Android system. This way you don't need to root your device.
Here is an example how I did on my Huawei p10 lite device.
# gain shell access
$ adb shell
# check who you are
$ whoami
shell
# obtain user id
$ id
uid=2000(shell) gid=2000(shell)
# list packages
$ pm list packages | grep google
package:com.google.android.youtube
package:com.google.android.ext.services
package:com.google.android.googlequicksearchbox
package:com.google.android.onetimeinitializer
package:com.google.android.ext.shared
package:com.google.android.apps.docs.editors.sheets
package:com.google.android.configupdater
package:com.google.android.marvin.talkback
package:com.google.android.apps.tachyon
package:com.google.android.instantapps.supervisor
package:com.google.android.setupwizard
package:com.google.android.music
package:com.google.android.apps.docs
package:com.google.android.apps.maps
package:com.google.android.webview
package:com.google.android.syncadapters.contacts
package:com.google.android.packageinstaller
package:com.google.android.gm
package:com.google.android.gms
package:com.google.android.gsf
package:com.google.android.tts
package:com.google.android.partnersetup
package:com.google.android.videos
package:com.google.android.feedback
package:com.google.android.printservice.recommendation
package:com.google.android.apps.photos
package:com.google.android.syncadapters.calendar
package:com.google.android.gsf.login
package:com.google.android.backuptransport
package:com.google.android.inputmethod.latin
# uninstall google play services (warning: take backup first!)
pm uninstall --user 0 com.google.android.gms
Yes, mobile device management would bring its own problems, but i bet 'Failure' is a dos2unix problem. On my Linux machines, adb is appending a DOS newline which causes 'Failure' because uninstall thinks the CR character is part of the package name. Also remove '-1.apk' from the end of the package-1.apk filename.
adb root
adb shell
pm list packages
pm uninstall com.android.chrome
In my case, i have a phone that is in permanent 'Safe mode' so only apps under /system/app/ have a chance of running. So i install them to get the .apk files copied off, then uninstall in bulk and copy to /system/app/, wipe the /cache and reboot. Now i have more apps running even though in safe mdoe.
# adb root
# pm list packages -3 > /root/bulkuninstall.txt
# vi /root/bulkuninstall.txt and check ^M characters at end of each line.
If ^M, then must run dos2unix /root/bulkuninstall.txt.
Remove '-1.apk' using vi search and replace:
:%s/-1\.apk//g
Or sed...
# cp /data/app/* /storage/sdcard1/APKs/
# for f in `cat /root/bulkuninstall.txt`; do echo $f; pm uninstall $f; done;
#
# echo Now remount system and copy the APK files to /system/app/
# mount | grep system
# mount -o remount,rw /dev/block/(use block device from previous step) /system
# cp /storage/sdcard1/APKs/* /system/app/
# reboot
wipe cache
power on.
This is not an exact answer, but if you're looking to uninstall the app because you have an updated .apk to install, you can try this:
adb install -r yourapp.apk
The -r option tells adb to reinstall the app
If it is an Android internal app you may need to:
adb shell
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
rm /system/app/your_app
rm /data/data/your_app
remove any entries in /data/system/packages.xml
remove any entries in /data/system/packages.list
edit AndroidManifest.xml and get rid of android:sharedUserId="android.uid.shared"
This is at your own risk;-|, try in emulator first...
Just run ADB and use the following command:
adb shell pm uninstall -k --user 0 <package name>
And you should get this return:
successful
okey I was in same situation I tried all of this without result.. and the last answer was close.. I got it doing the follow:
in order to get the right name of your package do the follow:
adb shell pm list packages | grep "name of your app here"
you should see the right name of your app.. so now this one just works:
adb uninstall com.your-real-app-name
finally the command run works again:
ionic run android
Seems like you have an app that contains a hidden Device Administrator like this one here: http://www.symantec.com/security_response/writeup.jsp?docid=2013-060411-4146-99
you can only uninstall such an app when you disable the device admin first. You can use https://play.google.com/store/apps/details?id=com.trendmicro.mtrt.hiddenDAcleaner to disable it or do it by your own by sending the intent to the app that invokes the receiver that will disable the device admin.
I find that adb shell pm uninstall <package> works consistently, where adb uninstall <package> does not.
Try disable "Instant run" from settings window
Open your application Manifest and check the application's package first.
After that, be sure that your device is set into debugger mode.
Check if ADB can interact with your device:
adb devices
If your device is listed, then run:
adb uninstall PACKAGE_WRITTEN_IN_MANIFEST
Maybe you're trying to uninstall an app that is a phone administrator.
To be able to uninstall it, go to Seetings > Security > Phone Administrators.
If the app is listed, uncheck it and confirm the operation.
After that, you should be able to uninstall it using the App settings area or adb.
You should have to manually delete apps. got to Setting-> Application Management -> Running application, tap on it and you can remove, stop apps from there.
This worked for me:
This is the directory where all the APKs are stored:
cd /system/app
List them:
ls
Choose one to remove.
pm install -r <app_to_remove>.apk
Example:
$ pm install -r Google-Play-services.apk
pkg: Google-Play-services.apk
Success
I noticed that I get failure if the application I'm trying to remove is running, so kill it first.
Also, I noticed you might have to run (on a rooted device):
$ su
# mount -o remount +rw /
In my case I often get this issue when I first complise a app in debug mode and later try to install the google signed app.
That is because both apps have the same package name but diffent signatures.
Since I upgraded to Android lollypop I sometimes even get this error if I uninstall the app via the settings\Apps.
If you have this problem check if the app is installed in a other User profile and uninstall it in all user accounts.
If you have problems uninstalling through adb, I can recommend the following tool:
https://github.com/patrickfav/uber-adb-tools
you can use wildcards and supports multiple devices, also has some better error handling than the vanilla ADB (but uses it in background of course). Will work on your platform.
Full disclaimer: I am the developer
Make sure you enter the full package name with application name:
com.domain.app
I had a instance of an emulator running and a device connected.
When I ran command `adb -d uninstall PACKAGE_NAME', I got an error 'DELETE_FAILED_INTERNAL_ERROR' but when I killed the Emulator instance, I got a 'success' in un-installation process.
It can be something as simple as typing the package name in the wrong case...
I had the same problem - turned out I was entering the package name in all lower case when the actual package name included upper case characters.
adb uninstall -k <packageName - eg. com.test.app>
( If you're explicitly uninstalling you probably don't want the -k which keeps the app data and cache directories around. )
You can follow below steps to uninstall the app from the device via command prompt.
execute the command : adb -s [devicename] uninstall -k [packagename].
this command will retain the data and cache in the device but will remove the app from the device.
To remove the data and cache also from the device along with the application execute the command below.
adb shell pm uninstall -k [packagename].
if it shows sucess your app is uninstalled successfully'
If You use Xiomi Device then You need to Login in MI Account.
After Successful Registration you can install and Uninstall via ADB.
You have the name of the apk and not the package name:
You should first know the package name. Fot this tape:
adb shell pm list packages
Once you have the package name (be carefull, package name is like com.intel.... and not package:com.intel...), tape:
adb shell pm uninstall -k "package_name"
and Bingo!
In my case this was happening because I was trying to uninstall the wrong APK. I didn't realize that my bundleId had appended .demo to the ID.
I had a failure when using adb shell uninstall com.package.app/
removed / (so adb shell uninstall com.package.app) and it works
Try disable "Instant run" from Preference!
It's working for me.

Categories

Resources