adb uninstall failed

2019-01-21 09:24发布

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.

标签: android adb
22条回答
疯言疯语
2楼-- · 2019-01-21 09:41

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 /
查看更多
兄弟一词,经得起流年.
3楼-- · 2019-01-21 09:41

If You use Xiomi Device then You need to Login in MI Account.

After Successful Registration you can install and Uninstall via ADB.

查看更多
Ridiculous、
4楼-- · 2019-01-21 09:42

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.

查看更多
放我归山
5楼-- · 2019-01-21 09:44

I had a failure when using adb shell uninstall com.package.app/

removed / (so adb shell uninstall com.package.app) and it works

查看更多
做个烂人
6楼-- · 2019-01-21 09:47

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.

查看更多
劳资没心,怎么记你
7楼-- · 2019-01-21 09:48

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.

查看更多
登录 后发表回答