PackageManager:不授予权限 - Android M.

时间:2017-03-01 11:03:42

标签: android apk android-6.0-marshmallow android-install-apk android-app-indexing

我正在使用某个应用程序进行基准测试

当我安装应用程序时,我从packagemanager获取这些日志。该 Android版本是Marshmallow,我知道app targetSdkVersion是22(所以我希望这与M一起使用)

09-07 02:24:05.407  1174  1204 W PackageManager: Not granting permission android.permission.READ_PHONE_STATE to package com.antutu.ABenchMark because it was previously installed without
09-07 02:24:05.407  1174  1204 W PackageManager: Not granting permission android.permission.READ_EXTERNAL_STORAGE to package com.antutu.ABenchMark because it was previously installed without
09-07 02:24:05.407  1174  1204 W PackageManager: Not granting permission android.permission.WRITE_EXTERNAL_STORAGE to package com.antutu.ABenchMark because it was previously installed without

我在启动完成后从脚本安装应用程序

pm install -r /system/priv-app/Benchmarking/app/app-debug.apk > /dev/kmsg
pm grant com.antutu.ABenchMark android.permission.READ_PHONE_STATE
pm grant com.antutu.ABenchMark android.permission.WRITE_EXTERNAL_STORAGE
pm grant com.antutu.ABenchMark android.permission.READ_EXTERNAL_STORAGE
am start -n com.antutu.ABenchMark/com.antutu.ABenchMark.ABenchMarkStart -e 74Sd42l35nH e57b6eb9906e27062fc7fcfcc820b957a5c33b649 > /dev/kmsg

此外,我使用的是h / w模拟器而不是开发板,所以它就像每次尝试新操作系统并安装应用程序一样

1 个答案:

答案 0 :(得分:0)

在重新安装之前卸载它时,问题可能会得到解决

 pm uninstall -r /system/priv-app/Benchmarking/app/app-debug.apk > /dev/kmsg