细细看,清单文件中先加权限
android.permission.REQUEST_INSTALL_PACKAGES
1保证已有外部读写权限:
2
implementation ‘com.yanzhenjie:permission:2.0.3’
3
安装apk相关代码
File file = ...;
AndPermission.with(this)
.install()
.file(file)
.start();
https://yanzhenjie.com/AndPermission/cn/install/
https://github.com/yanzhenjie/AndPermission