├── LICENSE ├── README-English.MD ├── README.md └── uninstall.py /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 allen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README-English.MD: -------------------------------------------------------------------------------- 1 | ## About 2 | 3 | With this Python Script you can uninstall some apps in your Phone or Simulator. 4 | 5 | with Python Script and ADB shell command and CMD of As,we can achieve this function easily. 6 | 7 | Anything you do not understand,you can find my Email in my GitHub page Home,you can contact with me. 8 | 9 | ## Effect 10 | 11 | ![](http://7xrl8j.com1.z0.glb.clouddn.com/Use.gif) 12 | 13 | [another Gif see Here](http://7xrl8j.com1.z0.glb.clouddn.com/autoDelete.gif) 14 | 15 | ## Usage 16 | 17 | * Make sure your AS can run ADB command. 18 | * Configuring Python 2.7 environment,Maybe Python 3+ ok, too. 19 | * With the AS's CMD,Find the current script path.Enter: python unistall.py. 20 | * Follow the tips of Script ,enter the App's core name,just like:com.example.RxCacheDemo ,you just need enter:example. 21 | * Finish the above,whether uninstall Successful,you will see the prompt. 22 | 23 | 24 | 25 | **And My script offer some other Features,you can see detail of the source code** 26 | 27 | ## Reference 28 | * [ADB shell Commond](http://imsardine.simplbug.com/note/android/adb/commands/pm.html) 29 | * [ADB Command](https://segmentfault.com/a/1190000000426049) 30 | * [Python os.popen](http://www.cnblogs.com/HQMIS/archive/2013/02/03/2890892.html) 31 | 32 | ## Help 33 | 34 | Core Code Here,May it will be useful for you 35 | 36 | ![](http://7xrl8j.com1.z0.glb.clouddn.com/helpDemo.png) 37 | 38 | ## License 39 | 40 | The MIT License (MIT) 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Uninstall-App-Automatically 2 | A python script for uninstalling the app in your Phone or Simulator automatically 3 | 4 | **中文说明 | [README-EN](https://github.com/wuchangfeng/Automatic-unistall-App/blob/master/README-English.MD)** 5 | 6 | ## About 7 | 开发 Android 的朋友,模拟器或者手机里面常常有大量调试的 Demo,对于手机来说还好,可是对于模拟器,有可能就会造成调试速度以及启动速度的下降。 8 | 而且模拟器中 App 一个一个删除也是很麻烦。利用 ADB 命令,我们可以做很多事,其中就包括批量操作模拟器或者手机上的 App。当然包括删除操作啦。 9 | 利用 Python 脚本和 ADB shell 命令以及 AS 自带的 CMD 窗口,我们就可以将这一切浓缩成一个命令行啦。 10 | 11 | 12 | ## Usage 13 | 14 | ``` python 15 | pip install uninstall_app 16 | ``` 17 | 批量卸载模拟器第三方 App 18 | 19 | ``` python 20 | $ ca 21 | ``` 22 | 23 | 24 | ## Effect 25 | 26 | ![](http://7xrl8j.com1.z0.glb.clouddn.com/Use.gif) 27 | 28 | 29 | ## Reference 30 | * [ADB shell 命令](http://imsardine.simplbug.com/note/android/adb/commands/pm.html) 31 | * [ADB 常用命令](https://segmentfault.com/a/1190000000426049) 32 | * [Python 执行系统命令 os.popen](http://www.cnblogs.com/HQMIS/archive/2013/02/03/2890892.html) 33 | 34 | ## License 35 | 36 | The MIT License (MIT) 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /uninstall.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | #!/usr/bin/env python 3 | import os; 4 | 5 | # 删除所有你指定包名的 APP 6 | def delAllapp( ): 7 | print 'start delete all your app in your Phone or Simulator ' 8 | os.popen('adb wait-for-device'); 9 | corename = raw_input("input your app package corename:") 10 | oriPackages = os.popen('adb shell pm list packages {name}'.format(name=corename)); 11 | # list all PackageName 12 | for oriPackage in oriPackages: 13 | deletePackage = oriPackage.split(':')[1] 14 | os.popen('adb uninstall ' + deletePackage ); 15 | print deletePackage + "is deleted" 16 | 17 | 18 | # 删除所有你指定包名的特定 APP 19 | def listAllpackage( ): 20 | i = 0 21 | os.popen('adb wait-for-device'); 22 | corename = raw_input("input your app package corename:") 23 | oriPackages = os.popen('adb shell pm list packages {name}'.format(name=corename)); 24 | 25 | for oriPackage in oriPackages: 26 | deletePackage = oriPackage.split(':')[1] 27 | print str(i) + ":" + deletePackage 28 | deleteList.append(deletePackage) 29 | i += 1 30 | 31 | def deleteApp(number): 32 | os.popen('adb uninstall ' + deleteList[number] ); 33 | print 'delete '+ deleteList[number] + "success" 34 | 35 | # 清除 LogCat 缓存 36 | def clearLogcat( ): 37 | print 'start clear logcat buffer in your Phone or Simulator' 38 | os.popen('adb wait-for-device'); 39 | os.popen('adb logcat -c'); 40 | print 'logcat is cleared success' 41 | 42 | 43 | if __name__ == '__main__': 44 | 45 | delAllapp() 46 | #deleteList = [] 47 | #listAllpackage() 48 | #number = raw_input("input the number of app you want to delete:") 49 | #deleteApp(int(number)) 50 | clearLogcat() 51 | --------------------------------------------------------------------------------