【Android】魅族Flyme OS 3摄像头无法预览的问题
错误代码:
12-12 14:28:34.692: E/AndroidRuntime(1524): java.lang.RuntimeException: startPreview failed
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.hardware.Camera.startPreview(Native Method)
12-12 14:28:34.692: E/AndroidRuntime(1524): at com.nmbb.example.sampleexecutejs.CameraDemoActivity.surfaceCreated(CameraDemoActivity.java:85)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.SurfaceView.updateWindow(SurfaceView.java:569)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.SurfaceView.access$000(SurfaceView.java:86)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:174)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:680)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1896)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:999)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4470)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.Choreographer.doFrame(Choreographer.java:532)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.os.Handler.handleCallback(Handler.java:725)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.os.Handler.dispatchMessage(Handler.java:92)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.os.Looper.loop(Looper.java:137)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.app.ActivityThread.main(ActivityThread.java:5068)
12-12 14:28:34.692: E/AndroidRuntime(1524): at java.lang.reflect.Method.invokeNative(Native Method)
12-12 14:28:34.692: E/AndroidRuntime(1524): at java.lang.reflect.Method.invoke(Method.java:511)
12-12 14:28:34.692: E/AndroidRuntime(1524): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-12 14:28:34.692: E/AndroidRuntime(1524): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-12 14:28:34.692: E/AndroidRuntime(1524): at dalvik.system.NativeStart.main(Native Method)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.hardware.Camera.startPreview(Native Method)
12-12 14:28:34.692: E/AndroidRuntime(1524): at com.nmbb.example.sampleexecutejs.CameraDemoActivity.surfaceCreated(CameraDemoActivity.java:85)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.SurfaceView.updateWindow(SurfaceView.java:569)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.SurfaceView.access$000(SurfaceView.java:86)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:174)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:680)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1896)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:999)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4470)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.Choreographer.doFrame(Choreographer.java:532)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.os.Handler.handleCallback(Handler.java:725)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.os.Handler.dispatchMessage(Handler.java:92)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.os.Looper.loop(Looper.java:137)
12-12 14:28:34.692: E/AndroidRuntime(1524): at android.app.ActivityThread.main(ActivityThread.java:5068)
12-12 14:28:34.692: E/AndroidRuntime(1524): at java.lang.reflect.Method.invokeNative(Native Method)
12-12 14:28:34.692: E/AndroidRuntime(1524): at java.lang.reflect.Method.invoke(Method.java:511)
12-12 14:28:34.692: E/AndroidRuntime(1524): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-12 14:28:34.692: E/AndroidRuntime(1524): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-12 14:28:34.692: E/AndroidRuntime(1524): at dalvik.system.NativeStart.main(Native Method)
错误原因:
只要给Activity设置了android:process属性,就没法预览!!!出现在魅族Flyme OS 3中,Flyme OS 1和Flyme OS 2没有问题。
解决方法:
暂时没啥好办法,只能不用android:process