在Logout中搜索camera出现以下错误
2022-04-17 09:06:17.753 25405-25405/com.android.camera2 E/AndroidRuntime: FATAL EXCEPTION: main Process: com.android.camera2, PID: 25405 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.camera2/com.android.camera.CaptureActivity}: java.lang.NullPointerException: Attempt to get length of null array at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) at android.os.Handler.dispatchMessage(Handler.java:107) 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: java.lang.NullPointerException: Attempt to get length of null array at com.android.camera.CameraActivity.shouldUseNoOpLocation(CameraActivity.java:1753) at com.android.camera.CameraActivity.onCreateTasks(CameraActivity.java:1438) at com.android.camera.util.QuickActivity.onCreate(QuickActivity.java:114) at android.app.Activity.performCreate(Activity.java:7802) at android.app.Activity.performCreate(Activity.java:7791) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
需要在AndroidManifest.xml中添加获取储存卡的权限
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
赋予应用使用存储权限
到此这篇Android编程权威指南(第4版)第16章使用Intent调用相机闪退问题_android调用相机后拍照后崩溃的文章就介绍到这了,更多相关Android编程权威指南(第4版)第16章使用Intent调用相机闪退问题_android调用相机后拍照后崩溃内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!版权声明:
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权、违法违规、事实不符,请将相关资料发送至xkadmin@xkablog.com进行投诉反馈,一经查实,立即处理!
转载请注明出处,原文链接:https://www.xkablog.com/androidbc/2658.html