当前位置:网站首页 > Android编程 > 正文

Android编程权威指南(第4版)第16章使用Intent调用相机闪退问题_android调用相机后拍照后崩溃

在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调用相机后拍照后崩溃内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!

版权声明


相关文章:

  • Android编程权威指南第3版 源代码_android编程权威指南 第4版pdf2024-10-30 13:56:20
  • Android初学者书籍推荐_android入门书籍推荐2024-10-30 13:56:20
  • Android编程7:控件ListView使用_android控件大全及用法2024-10-30 13:56:20
  • Android高级编程_Android高级编程2024-10-30 13:56:20
  • Android编程中利用AudioTrack播放PCM数据在音频的最后出现重复回声现象的解决方案_androidhttp编程2024-10-30 13:56:20
  • 人人视频android app,人人视频安卓版2024-10-30 13:56:20
  • Android购物车2024-10-30 13:56:20
  • Android项目中添加Dobby(inline hook)2024-10-30 13:56:20
  • android随机抽奖代码_随机抽奖生成器app下载|随机抽奖生成器软件下载_v1.0_9ht安卓下载...2024-10-30 13:56:20
  • Android平台签名证书(.keystore)2024-10-30 13:56:20
  • 全屏图片