Call to getInstalledModules before metadata loaded
拉起安卓Q虚拟机的手机系统的设置界面报错,具体如下。
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.settings/com.android.settings.Settings$ManageAppExternalSourcesActivity}: java.lang.IllegalStateException: Call to getInstalledModules before metadata loaded
实现的代码大概是这样子的:
Intent intent =new Intent();
Uri packageURI = Uri.parse("package:"+mContext.getPackageName());
intent.setData(packageURI);
intent.setAction(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES);
startActivityForResult(intent,REQUESTCODE);
根据在虚拟机上的谷歌浏览器的表现,在谷歌浏览器下载XXX.apk进行安装。提示要权限,也是会崩溃。
还望大佬们解答