phonegap Camera.PictureSourceType.PHOTOLIBRARY不适用于android

phonegap Camera.PictureSourceType.PHOTOLIBRARY不适用于android,android,cordova,android-gallery,Android,Cordova,Android Gallery,我正在使用phonegap从设备摄像头或多媒体资料中获取图像。摄像头部分工作正常,但当我单击调用galleryButton()的按钮时,应用程序就卡住了。这是我正在使用的代码: function cameraButton() { callLib(Camera.PictureSourceType.CAMERA); } function galleryButton() { callLib(Camera.PictureSourceType.PHOTOLIBRARY); } func

我正在使用phonegap从设备摄像头或多媒体资料中获取图像。摄像头部分工作正常,但当我单击调用galleryButton()的按钮时,应用程序就卡住了。这是我正在使用的代码:

function cameraButton() {
    callLib(Camera.PictureSourceType.CAMERA);
}

function galleryButton() {
    callLib(Camera.PictureSourceType.PHOTOLIBRARY);
}

function callLib(sourceType) {
    navigator.camera.getPicture(onSuccess, onFail, {    quality: 50,
                                                        destinationType : Camera.DestinationType.DATA_URL, 
                                                        sourceType : sourceType, 
                                                        allowEdit : false,
                                                        encodingType: Camera.EncodingType.JPEG,
                                                        targetWidth: 512,
                                                        targetHeight: 512,
                                                        saveToPhotoAlbum: false } );
}
Logcat输出:

09-02 18:51:39.238: V/webcore(16739): SET_GLOBAL_BOUNDS arg1=0 arg2=0 obj=Rect(0, 25 - 320, 480)
09-02 18:51:39.238: V/webcore(16739): VIEW_SIZE_CHANGED arg1=0 arg2=0 obj=android.webkit.WebView$ViewSizeData@44b56268
09-02 18:51:39.238: V/webcore(16739): viewSizeChanged w=320; h=455; textwrapWidth=320; scale=1.0
09-02 18:51:39.238: V/webcore(16739): SET_ACTIVE arg1=0 arg2=0 obj=null
09-02 18:51:39.248: V/webcore(16739): WEBKIT_DRAW arg1=0 arg2=0 obj=null
09-02 18:51:39.248: V/webcore(16739): webkitDraw start
09-02 18:51:39.258: V/webcore(16739): webkitDraw NEW_PICTURE_MSG_ID
09-02 18:51:39.268: V/webcore(16739): UPDATE_CACHE_AND_TEXT_ENTRY arg1=0 arg2=0 obj=null
09-02 18:51:39.268: V/webcore(16739): UPDATE_CACHE_AND_TEXT_ENTRY arg1=0 arg2=0 obj=null
09-02 18:51:39.278: V/webview(16739): NEW_PICTURE_MSG_ID
09-02 18:51:39.278: V/webview(16739): NEW_PICTURE_MSG_ID {0,0,320,480}
09-02 18:51:39.278: V/webview(16739): UPDATE_TEXT_ENTRY_MSG_ID
09-02 18:51:39.278: V/webview(16739): UPDATE_TEXT_ENTRY_MSG_ID
09-02 18:51:42.158: V/webview(16739): MotionEvent{44b254f0 action=0 x=118.62812 y=53.83542 pressure=1.0 size=0.0} at 33266232 mTouchMode=7
09-02 18:51:42.158: V/webcore(16739): UPDATE_FRAME_CACHE_IF_LOADING arg1=0 arg2=0 obj=null
09-02 18:51:42.168: V/webview(16739): MotionEvent{44b254f0 action=2 x=118.62812 y=53.83542 pressure=1.0 size=0.0} at 33266242 mTouchMode=1
09-02 18:51:42.198: V/webview(16739): MotionEvent{44b254f0 action=2 x=118.62812 y=53.83542 pressure=1.0 size=0.0} at 33266262 mTouchMode=1
09-02 18:51:42.228: V/webview(16739): MotionEvent{44b254f0 action=2 x=118.62812 y=53.83542 pressure=1.0 size=0.0} at 33266292 mTouchMode=1
09-02 18:51:42.248: V/webview(16739): MotionEvent{44b254f0 action=2 x=118.62812 y=53.83542 pressure=1.0 size=0.0} at 33266322 mTouchMode=1
09-02 18:51:42.268: V/webview(16739): MotionEvent{44b254f0 action=1 x=118.62812 y=53.83542 pressure=1.0 size=0.0} at 33266342 mTouchMode=1
09-02 18:51:42.572: V/webview(16739): RELEASE_SINGLE_TAP
09-02 18:51:42.572: V/webcore(16739): VALID_NODE_BOUNDS arg1=0 arg2=0 obj=android.webkit.WebViewCore$MotionUpData@44b64c30
09-02 18:51:42.572: V/webview(16739): DO_MOTION_UP
09-02 18:51:42.578: V/webcore(16739): TOUCH_UP arg1=0 arg2=0 obj=android.webkit.WebViewCore$TouchUpData@44b650e0
09-02 18:51:42.578: V/webcore(16739): WEBKIT_DRAW arg1=0 arg2=0 obj=null
09-02 18:51:42.588: V/webcore(16739): webkitDraw start
09-02 18:51:42.588: V/webcore(16739): webkitDraw NEW_PICTURE_MSG_ID
09-02 18:51:42.598: V/webview(16739): NEW_PICTURE_MSG_ID
09-02 18:51:42.598: V/webview(16739): NEW_PICTURE_MSG_ID {98,38,159,72}
我有以下权限:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CAMERA"/>

编辑
一切都很完美。galleryButton()从未被调用:P我的错误。请关闭此问题。

这些可选参数仅用于自定义相机设置。 允许:错误, 编码类型:Camera.encodingType.JPEG, targetWidth:512, 目标灯:512

为photolib创建一个新函数,该函数将包含 质量:40, 目标类型: 源类型: