我有一个程序,它正在使用android 6.0而没有任何错误,但在7.0上不起作用。我可以在7.0中启动我的程序,但是当我想在其中使用我的相机时,它每次都会退出。有什么问题? (在android studio中,它设置为从6.0到7.1.1兼容)
10-10 15:17:40.193 18001-18001 / erdosk.stockidbp I / OpenCameraSource:相机对焦模式:此设备不支持连拍。 10-10 15:17:40.194 18001-18001 / erdosk.stockidbp I / SurfaceView:35685123 finishedDrawing,this = android.view.SurfaceView {2208303 VE ..... ...... ID -28,0-629,876 10-10 15:17:40.202 18001-18001 / erdosk.stockidbp D / AndroidRuntime:关闭VM 10-10 15:17:40.216 18001-18001 / erdosk.stockidbp E / AndroidRuntime:FATAL EXCEPTION:main
进程:erdosk.stockidbp,PID:18001 java.lang.NullPointerException:尝试在erdosk.stockidbp的空对象引用上调用接口方法'boolean java.util.List.contains(java.lang.Object)'。在erdosk.stockidbp的erdosk.stockidbp.camera.Came上获取erdosk.stockidbp.camera.Camerabp.camera.CameraSourcePreview.startIfReady(CameraSourcePreview.java:82)的相机.CameraSource.createCamera(CameraSource.java:510) .camera.CameraSourcePreview.access $ 200(CameraSourcePreview.java:32)在android.view.SurfaceView.updateWindow(SurfaceView.java:709)的erdosk.stockidbp.camera.CameraSourcePreview $ SurfaceCallback.surfaceCreated(CameraSourcePreview.java:92) .view.SurfaceView $ 3.onPreDraw(SurfaceView.java:180),位于android.view.View.Iv.DerPreDraw(ViewTreeObserver.java:944),位于android.view.ViewRootImpl的android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2553) .doTraversal(ViewRootImpl.java:1462)在android.view.ViewRootImpl $ TraversalRunnable .run(ViewRootImpl.java:6965)在android.view.Choreographer $ CallbackRecord.run(Choreographer.java:907)的android.view.Chopographer.doCallbacks(Choreographer.java:709)android.view.Choreographer.doFrame( Choreographer.java:644)在android.view.Handler.dispatchMessage(Handler.java)的android.view.Choreographer $ FrameDisplayEventReceiver.run(Choreographer.java:893)android.os.Handler.handleCallback(Handler.java:836) :103)在android.os.Looper.loop(Looper.java:203)的android.app.ActivityThread.main(ActivityThread.java:6251),位于com的java.lang.reflect.Method.invoke(Native Method)。 android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1063)at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
答案 0 :(得分:1)
看起来像缺少Runtime-Permission(使用相机)。或者使用带有相机意图的“file://”URL。