Android 加了电话权限,运行还是闪退报错 作者: Chuwen 时间: 2019-12-07 分类: Android 评论 `AndroidManifest.xml` 文件 ``` ``` # 运行报错 ``` D/AndroidRuntime: Shutting down VM E/AndroidRuntime: FATAL EXCEPTION: main Process: cc.nowtime.seven, PID: 12685 java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel:xxxxx cmp=com.android.server.telecom/.components.UserCallActivity } from ProcessRecord{e2ed078 12685:cc.nowtime.seven/u0a135} (pid=12685, uid=10135) with revoked permission android.permission.CALL_PHONE at android.os.Parcel.createException(Parcel.java:2071) at android.os.Parcel.readException(Parcel.java:2039) at android.os.Parcel.readException(Parcel.java:1987) at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:3851) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1705) at android.app.Activity.startActivityForResult(Activity.java:5192) at android.app.Activity.startActivityForResult(Activity.java:5150) at android.app.Activity.startActivity(Activity.java:5521) at android.app.Activity.startActivity(Activity.java:5489) at cc.nowtime.seven.MainActivity$1.onClick(MainActivity.java:36) at android.view.View.performClick(View.java:7125) at android.view.View.performClickInternal(View.java:7102) at android.view.View.access$3500(View.java:801) at android.view.View$PerformClick.run(View.java:27336) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) Caused by: android.os.RemoteException: Remote stack trace: at com.android.server.wm.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1043) at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:760) at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:583) at com.android.server.wm.ActivityStarter.startActivityMayWait(ActivityStarter.java:1288) at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:514) Process 12685 terminated. ``` > ` java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel:xxxxx cmp=com.android.server.telecom/.components.UserCallActivity } from ProcessRecord{e2ed078 12685:cc.nowtime.seven/u0a135} (pid=12685, uid=10135) with revoked permission android.permission.CALL_PHONE` # 原因 你的 APP 添加**拨打电话权限**,但是未申请拨打电话权限,所以报错,解决办法: - **APP 主动申请获取** 拨打电话权限 - **手动授予** 拨打电话权限 # 主动授予拨打电话权限 1. 打开 **设置** > **应用和通知** 2. **找到你的应用** ![Snipaste_2019-12-07_20-13-40.png][1] 3. 然后允许对应权限就可以了 ![Snipaste_2019-12-07_20-14-38.png][2] # APP 主动申请获取 拨打电话权限 > 自己百度 ❀???? [1]: https://cdn.nowtime.cc/2019/12/07/512779244.png [2]: https://cdn.nowtime.cc/2019/12/07/1174856951.png