当前位置:   article > 正文

Android 11安装apk异常java.lang.SecurityException: Permission Denial:_android11 调用apk安装

android11 调用apk安装

安装apk时出现There was a problem parsing the package 提示信息从抓log信息如下:

03-21 00:58:40.010   926  1129 W ActivityManager: Permission Denial: opening provider android.support.v4.content.FileProvider from ProcessRecord{42b8ead 2152:com.android.packageinstaller/u0a7} (pid=2152, uid=10007) that is not exported from UID 1000
03-21 00:58:40.011  2152  2178 W InstallStaging: Error staging apk from content URI
03-21 00:58:40.011  2152  2178 W InstallStaging: java.lang.SecurityException: Permission Denial: opening provider android.support.v4.content.FileProvider from ProcessRecord{42b8ead 2152:com.android.packageinstaller/u0a7} (pid=2152, uid=10007) that is not exported from UID 1000
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.os.Parcel.createException(Parcel.java:2357)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.os.Parcel.readException(Parcel.java:2340)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.os.Parcel.readException(Parcel.java:2282)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.app.IActivityManager$Stub$Proxy.getContentProvider(IActivityManager.java:5702)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.app.ActivityThread.acquireProvider(ActivityThread.java:6813)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2930)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:2481)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1967)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1798)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.content.ContentResolver.openInputStream(ContentResolver.java:1475)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at com.android.packageinstaller.InstallStaging$StagingAsyncTask.doInBackground(InstallStaging.java:174)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at com.android.packageinstaller.InstallStaging$StagingAsyncTask.doInBackground(InstallStaging.java:167)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.os.AsyncTask$3.call(AsyncTask.java:394)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at java.lang.Thread.run(Thread.java:923)
03-21 00:58:40.011  2152  2178 W InstallStaging: Caused by: android.os.RemoteException: Remote stack trace:
03-21 00:58:40.011  2152  2178 W InstallStaging:        at com.android.server.am.ActivityManagerService.getContentProviderImpl(ActivityManagerService.java:7155)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at com.android.server.am.ActivityManagerService.getContentProvider(ActivityManagerService.java:7595)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2381)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2883)
03-21 00:58:40.011  2152  2178 W InstallStaging:        at android.os.Binder.execTransactInternal(Binder.java:1154)

经过查找各种资料都没解决,此问题困扰了我许多天,开心的是经过不断的努力,最后参考这位大神博客找到了解决方法,​​​Android android.uid.system的应用调用安装apk失败 - 灰信网(软件开发博客聚合)非常感谢这位大神的分享。为上能让其他人少踩坑,我也做个小记录希望能帮助到遇到同样问题的小伙伴们。

注意:android 11系统里的For security reasons, the system cannot issue a Uri permission grant to”这段log是在源码 framework/base/services/core/java/com/android/server/uri/UriGrantsManagerService.java 打出来的

功夫不负有心人,终于把困扰我好多天的问题解决了

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号