Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android 2.3.x上,文档页面中的摄像头示例失败_Android_Cordova - Fatal编程技术网

在android 2.3.x上,文档页面中的摄像头示例失败

在android 2.3.x上,文档页面中的摄像头示例失败,android,cordova,Android,Cordova,我正在创建一个phonegap应用程序,用于在android手机中捕捉照片。它在安卓4.x上运行良好。但不适用于android 2.3.x 出现如下错误: 对不起! 应用程序AppName(packagename)意外停止。请重试 我已经创建了上述项目,并使用了完整的示例 我的phonegep html页面是: 不要使用Camera.destinationType.FILE\u URI而使用Camera.destinationType.FILE\u URI 请参阅下面的代码 navigator

我正在创建一个phonegap应用程序,用于在android手机中捕捉照片。它在安卓4.x上运行良好。但不适用于android 2.3.x

出现如下错误:

对不起! 应用程序AppName(packagename)意外停止。请重试

我已经创建了上述项目,并使用了完整的示例

我的phonegep html页面是:



不要使用Camera.destinationType.FILE\u URI而使用Camera.destinationType.FILE\u URI

请参阅下面的代码

navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50, destinationType: Camera.DestinationType.FILE_URI });
它在2.3.x和4.x上都适用

希望这有帮助。

默认的Phonegap(Cordova)摄像头插件调用本机摄像头,这使得Android垃圾收集器可以杀死后台应用程序。此插件可避免您的应用程序进入后台,并与其他应用程序一起被垃圾收集器杀死。我们使用Phonegap源代码并对其进行了修改以避免此问题。此插件仅适用于文件URI


我们也面临着这个问题。这是一场表演。有什么帮助吗?有人吗?谢谢Napster。我们已经试过了。但还是失败了。给出相同的错误,这是我们脚本中唯一的区别。还有一件事,我用cordova 2.6感谢您的支持。最后用这个插件解决这个问题。现在它可以正常工作了。
05-16 14:51:38.249: E/AndroidRuntime(13459): FATAL EXCEPTION: main
05-16 14:51:38.249: E/AndroidRuntime(13459): java.lang.RuntimeException: Unable to resume activity {com.name/package}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=34, result=-1, data=Intent { (has extras) }} to activity {com.name/com.name.namedemo}: java.lang.NullPointerException
05-16 14:51:38.249: E/AndroidRuntime(13459):    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2120)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2135)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1668)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at android.os.Handler.dispatchMessage(Handler.java:99)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at android.os.Looper.loop(Looper.java:130)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at android.app.ActivityThread.main(ActivityThread.java:3683)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at java.lang.reflect.Method.invokeNative(Native Method)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at java.lang.reflect.Method.invoke(Method.java:507)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:875)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:633)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at dalvik.system.NativeStart.main(Native Method)
    05-16 14:51:38.249: E/AndroidRuntime(13459): Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=34, result=-1, data=Intent { (has extras) }} to activity {com.name/com.name.namedemo}: java.lang.NullPointerException
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at android.app.ActivityThread.deliverResults(ActivityThread.java:2532)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2107)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    ... 12 more
    05-16 14:51:38.249: E/AndroidRuntime(13459): Caused by: java.lang.NullPointerException
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at org.apache.cordova.DroidGap.onActivityResult(DroidGap.java:849)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at android.app.Activity.dispatchActivityResult(Activity.java:3908)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    at android.app.ActivityThread.deliverResults(ActivityThread.java:2528)
    05-16 14:51:38.249: E/AndroidRuntime(13459):    ... 13 more
    05-16 14:51:39.039: W/webcore(13459): Can't get the viewWidth after the first layout
navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50, destinationType: Camera.DestinationType.FILE_URI });