2012-01-28 30 views
13

我可以使用adb shell命令将自己的应用程序安装到/ system/app中。但如何卸载它?有没有什么命令可以做到这一点?我的手机扎根了。如何从/ system/app中卸载自己的应用程序?

+1

我想你可能会喜欢通过[链接](http://wiki.cyanogenmod.com/wiki/Barebones) – Relsell 2012-01-28 20:03:46

回答

14

手动卸载使用ADB:

http://www.careace.net/2010/05/12/how-to-remove-android-apps-through-adb/

编程:

public static void deleteFromSystem (final String file) 
    { 
     try 
     { 
      if (new File(file).exists()) 
      { 
       String path  = new File(file).getParent(); 
       Process process  = Runtime.getRuntime().exec("su"); 
       DataOutputStream os = new DataOutputStream(process.getOutputStream()); 
       os.writeBytes("mount -o rw,remount /system; \n"); 
       os.writeBytes("chmod 777 "  + path + "; \n"); 
       os.writeBytes("chmod 777 "  + file + "; \n"); 
       os.writeBytes("rm -r "   + file + "; \n"); 
       os.writeBytes("mount -o ro,remount /system; \n"); 
       os.writeBytes("reboot \n"); 
       os.flush(); 
       os.close(); 
       process.waitFor(); 
      } 
     } 
     catch (Throwable e) {e.printStackTrace();} 
    } 
+0

我在你的应用程序中试过了你的代码片段。已经从主屏幕中删除。但是卸载应用程序然后重新安装应用程序来管理它的sharedpreference状态后,我遇到了问题。我需要清楚的偏好。 – 2013-06-06 06:41:26

+0

此代码给我以下IO异常: Working Directory:null环境:null 是的,我使用了正确的应用程序名称。 – Behnam 2013-11-26 12:40:33

+0

@ Campiador你有没有根? – XXX 2013-11-26 14:17:00

1

我不确定你是否必须在每台设备上都这样做(可能只是通过某些设备上的root访问来实现),但是对于htc,你需要重启到恢复模式 然后你可以复制你的apk到SD卡,然后使用亚行外壳到/系统/应用程序文件夹 你应该创建一个备份nandroid第一

+0

对不起,我不能读:D无论如何,它应该有可能在恢复中删除它模式 – sherif 2012-01-28 19:38:49

11
adb shell rm /system/app/MyApp* 
adb uninstall org.my.app 
0

假设你必须设备根访问:

ADB壳 ス 安装邻RW,重新装入/系统 室射频/system/app/myApp.apk 室射频/数据/数据/ com.example.myapp 安装邻RO,重新装入/系统 出口 出口

3

假设你必须设备根访问:

adb shell 
su 
mount -o rw,remount /system 
rm -rf /system/app/myApp.apk 
rm -rf /data/data/com.example.myapp 
mount -o ro,remount /system 
exit 
exit