7

我需要在 android 8 手机上开始安装 apk,但这不应该是静默的(adb install)。行为应该就像用户触摸了设备上的 apk 文件一样。在 android 8 之前,可以通过 adb 启动 apk 的安装,如下所示:

adb shell am start -d file:"///sdcard/foobar.apk" -p com.google.android.packageinstaller

这在 android 8 上不再可行。根据日志文件,权限 android.permission.REQUEST_INSTALL_PACKAGES 是必要的。

09-25 16:39:55.691  6066  6066 E InstallStart: Requesting uid 2000 needs to declare permission android.permission.REQUEST_INSTALL_PACKAGES

我知道,由于要求安装其他应用程序的 android 8 应用程序需要此权限,但通过 adb 执行此操作不应该是这种情况,对吗?

这是android 8中的错误吗?有没有可能以其他方式做到这一点?

4

1 回答 1

12

尝试添加清单

<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
于 2018-03-27T14:17:09.497 回答