Java 当api 24和api 25中有新版本可用时,Android会以编程方式更新应用程序
我试图用牛轧糖更新我的应用程序,但我不能,我得到以下错误 代码 错误Java 当api 24和api 25中有新版本可用时,Android会以编程方式更新应用程序,java,android,android-layout,android-fragments,Java,Android,Android Layout,Android Fragments,我试图用牛轧糖更新我的应用程序,但我不能,我得到以下错误 代码 错误 请帮我解决这个问题我终于找到了解决方案 long referenceId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1); if(downloadReference == referenceId) { Timber.d("Downloading of the new app version complete"); //start the installa
请帮我解决这个问题我终于找到了解决方案
long referenceId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
if(downloadReference == referenceId) {
Timber.d("Downloading of the new app version complete");
//start the installation of the latest version
Intent installIntent = new Intent(Intent.ACTION_VIEW);
installIntent.setDataAndType(dm.getUriForDownloadedFile(downloadReference),
"application/vnd.android.package-archive")
installIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(installIntent);
那应该没问题。您可以尝试删除
FLAG\u ACTIVITY\u NEW\u TASK
,看看这是否有帮助。
Caused by: java.lang.SecurityException: Permission Denial: opening provider
android.support.v4.content.FileProvider from ProcessRecord{9dfaa8c
1646:com.google.android.packageinstaller/u0a17} (pid=1646, uid=10017) that is
not exported from uid 10173
long referenceId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
if(downloadReference == referenceId) {
Timber.d("Downloading of the new app version complete");
//start the installation of the latest version
Intent installIntent = new Intent(Intent.ACTION_VIEW);
installIntent.setDataAndType(dm.getUriForDownloadedFile(downloadReference),
"application/vnd.android.package-archive")
installIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(installIntent);