java.lang.SecurityException: Permission Denial: starting Intent { act=android.med 安卓7.0

开发中遇到

 java.lang.SecurityException: Permission Denial: starting Intent { act=android.media.action.IMAGE_CAPTURE flg=0x3 cmp=com.huawei.camera/.ThirdCamera clip={text/uri-list U:content://customer.huyi.com.huyicustomer.fileprovider/my_images/Android/data/customer.huyi.com.huyicustomer/cache/output_image.jpg} (has extras) } from ProcessRecord{7bb8683 25917:customer.huyi.com.huyicustomer/u0a385} (pid=25917, uid=10385) with revoked permission android.permission.CAMERA
        at android.os.Parcel.createException(Parcel.java:1953)
        at android.os.Parcel.readException(Parcel.java:1921)
        at android.os.Parcel.readException(Parcel.java:1871)
        at android.app.IActivityManager$Stub$Proxy.startActivity(IActivityManager.java:3733)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1753)
        at android.app.Activity.startActivityForResult(Activity.java:4781)
        at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54)
        at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:68)
        at android.app.Activity.startActivityForResult(Activity.java:4721)
        at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:744)
        at customer.huyi.com.huyicustomer.activity.MainActivity$onCreate$1.onClick(MainActivity.kt:67)
        at android.view.View.performClick(View.java:6652)
        at android.view.View.performClickInternal(View.java:6624)
        at android.view.View.access$3100(View.java:787)
        at android.view.View$PerformClick.run(View.java:26213)
        at android.os.Handler.handleCallback(Handler.java:891)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:207)
        at android.app.ActivityThread.main(ActivityThread.java:7470)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
     Caused by: android.os.RemoteException: Remote stack trace:

这个问题   是因为这个

startActivityForResult(intent, TAKE_PHOTO)

原理里面添加了动态权限,不能与本地权限有冲突

<!--<uses-permission android:name="android.permission.CAMERA" />-->我把Mainfest文件中的这句注释掉就好了

   

上一篇:又偷偷学了点黑客


下一篇:java.lang.SecurityException Permission Denial opening provider ngyb.createdatabase.AccountProvider