查询包名、权限&adb增加权限&adb版本更新

1、用 aapt d permissions xxx.apk, 来查询包名和权限,aapt 在路径sdk\build-tools\21.1.2下

     aapt dump badging D:\test\xxx.apk获取包名、权限、launchable-activity.


2、java 执行:adb shell pm grant 包名 权限, 来赋予权限。

private static String storage = "adb shell pm grant com.android.chrome android.permission.WRITE_EXTERNAL_STORAGE";
private static String storage2 = "adb shell pm grant com.android.chrome android.permission.WRITE_MEDIA_STORAGE";
private static String storage3 = "adb shell pm grant com.android.chrome android.permission.MOUNT_UNMOUNT_FILESYSTEMS";
private static String storage4 = "adb shell pm grant com.android.chrome android.permission.READ_EXTERNAL_STORAGE";
	
Runtime exec = Runtime.getRuntime();
exec.exec(storage);
exec.exec(storage2);
exec.exec(storage3);
exec.exec(storage4);

3、adb工具包最新Google官方版下载地址:

ADB和Fastboot for Windows

https://dl.google.com/android/repository/platform-tools-latest-windows.zip

ADB和Fastboot for Mac

https://dl.google.com/android/repository/platform-tools-latest-darwin.zip

ADB和Fastboot for Linux

https://dl.google.com/android/repository/platform-tools-latest-linux.zip

这些 Google 链接,用户可以确保下载不仅是官方的,而且将始终能够获得最新版本的 ADB 和 Fastboot

替换sdk\platform-tools\adb.exe即可。

4、appium h5测试调用的chromedriver路径

Appium\resources\app\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win


版权声明:本文为wuyepiaoxue789原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。