PhoneGap Camera onActivityResult崩溃了2.3.6

时间:2013-04-16 11:45:10

标签: android cordova camera

Possible duplicate

我在Android中使用PhoneGap框架实现Camera插件,它在4.0等工作但不能在2.3.6 android版本中运行。当捕获并返回到活动应用程序崩溃时,这里是logcat详细信息。我无法解决它。

04-16 16:54:36.171: E/AndroidRuntime(31774):    at android.app.ActivityThread.main(ActivityThread.java:3687)
04-16 16:54:36.171: E/AndroidRuntime(31774):    at java.lang.reflect.Method.invokeNative(Native Method)
04-16 16:54:36.171: E/AndroidRuntime(31774):    at java.lang.reflect.Method.invoke(Method.java:507)
04-16 16:54:36.171: E/AndroidRuntime(31774):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
04-16 16:54:36.171: E/AndroidRuntime(31774):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
04-16 16:54:36.171: E/AndroidRuntime(31774):    at dalvik.system.NativeStart.main(Native Method)
04-16 16:54:36.171: E/AndroidRuntime(31774): Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=34, result=-1, data=null} to activity {com.wtd.android.phonegapplugin/com.wtd.android.phonegapplugin.MainActivity}: java.lang.NullPointerException
04-16 16:54:36.171: E/AndroidRuntime(31774):    at android.app.ActivityThread.deliverResults(ActivityThread.java:2536)
04-16 16:54:36.171: E/AndroidRuntime(31774):    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2111)
04-16 16:54:36.171: E/AndroidRuntime(31774):    ... 12 more
04-16 16:54:36.171: E/AndroidRuntime(31774): Caused by: java.lang.NullPointerException
04-16 16:54:36.171: E/AndroidRuntime(31774):    at org.apache.cordova.DroidGap.onActivityResult(DroidGap.java:857)
04-16 16:54:36.171: E/AndroidRuntime(31774):    at android.app.Activity.dispatchActivityResult(Activity.java:3908)
04-16 16:54:36.171: E/AndroidRuntime(31774):    at android.app.ActivityThread.deliverResults(ActivityThread.java:2532)
04-16 16:54:36.171: E/AndroidRuntime(31774):    ... 13 more

现在我在4.0中找到的2.3.6版本的问题我已经测试过它的效果非常好。

我正在使用cordova-2.6.0.jar文件,cordova-2.6.0.js

如何克服这个?如何获取相机拍摄的图像?

我的AndroidManifest.xml文件

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.wtd.android.phonegapplugin"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:resizeable="true"
        android:smallScreens="true" />

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.RECORD_VIDEO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.BROADCAST_STICKY" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:configChanges="orientation|screenSize|keyboardHidden" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

由于

1 个答案:

答案 0 :(得分:0)

我只是将phonegap的版本更改为2.1.0以测试较低版本及其工作完美。不知道使用PhoneGap 2.6.0的问题是什么,同时它在2.3.6版本的模拟器中完美运行但在我的设备中得到Force Close