phonegap相机崩溃的应用程序

时间:2015-11-28 17:23:37

标签: cordova nullpointerexception camera crash

使用phonegap相机api拍摄几张照片后,Phonegap应用程序崩溃。 它不会发生在每张照片之后,而是仅在拍摄了几张照片之后。 我认为RAM没有释放导致崩溃。消息:不幸的是Gallery停了。 请帮助,如何强制释放RAM内存或其他解决方法。 这是什么意思:W / QComExtractorFactory(174):与嗅探不匹配< === status = 1

谢谢

这是LogCat:

11-27 18:06:55.751:E / camera(1799):发送音调条:mSkinToneSeekBar = false

11-27 18:06:55.751:D / CameraStorage(1799):外部存储状态=已安装

11-27 18:06:55.771:E / WVMExtractor(174):无法打开libwvm.so

11-27 18:06:55.771:W / QComExtractorFactory(174):与嗅探不匹配< === status = 5

11-27 18:06:55.771:W / QComExtractorFactory(174):与嗅探不匹配< === status = 1

11-27 18:06:55.771:W / QComExtractorFactory(174):与嗅探不匹配< === status = 1

11-27 18:06:55.771:W / QComExtractorFactory(174):与嗅探不匹配< === status = 1

11-27 18:06:55.771:E / MM_OSAL(174):ValidateAACFile失败

11-27 18:06:55.771:W / QComExtractorFactory(174):与嗅探不匹配< === status = 1 11-27 18:06:55.771:W / QComExtractorFactory(174):与嗅探不匹配< === status = 1

11-27 18:06:55.771:W / dalvikvm(1799):threadid = 1:线程退出时未捕获异常(组= 0x41297438)

11-27 18:06:55.781:E / AndroidRuntime(1799):致命异常:主

11-27 18:06:55.781:E / AndroidRuntime(1799):java.lang.NullPointerException

11-27 18:06:55.781:E / AndroidRuntime(1799):at com.android.camera.Camera.setDisplayOrientation(Camera.java:2232)

11-27 18:06:55.781:E / AndroidRuntime(1799):at com.android.camera.Camera.onConfigurationChanged(Camera.java:1992)

11-27 18:06:55.781:E / AndroidRuntime(1799):在android.app.ActivityThread.performConfigurationChanged(ActivityThread.java:3673)

11-27 18:06:55.781:E / AndroidRuntime(1799):在android.app.ActivityThread.handleConfigurationChanged(ActivityThread.java:3805)

11-27 18:06:55.781:E / AndroidRuntime(1799):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1347)

11-27 18:06:55.781:E / AndroidRuntime(1799):在android.os.Handler.dispatchMessage(Handler.java:99)

11-27 18:06:55.781:E / AndroidRuntime(1799):在android.os.Looper.loop(Looper.java:137)

11-27 18:06:55.781:E / AndroidRuntime(1799):在android.app.ActivityThread.main(ActivityThread.java:4875)

11-27 18:06:55.781:E / AndroidRuntime(1799):at java.lang.reflect.Method.invokeNative(Native Method)

11-27 18:06:55.781:E / AndroidRuntime(1799):at java.lang.reflect.Method.invoke(Method.java:511)

11-27 18:06:55.781:E / AndroidRuntime(1799):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:789)

11-27 18:06:55.781:E / AndroidRuntime(1799):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)

11-27 18:06:55.781:E / AndroidRuntime(1799):at dalvik.system.NativeStart.main(Native Method)

11-27 18:06:55.781:W / ActivityManager(634):强制完成活动com.android.gallery3d / com.android.camera.Camera

11-27 18:06:55.791:D / PowerManagerService(634):acquireWakeLock flags = 0x1 tag = ActivityManager-Launch

11-27 18:06:55.791:W / ActivityManager(634):强制完成活动com.myapp.test / .test

1 个答案:

答案 0 :(得分:2)

确保您的工作正常。

navigator.camera.getPicture(function(imageURL){            
            fileURI = imageURL;
            fileName = fileURI.substr(fileURI.lastIndexOf('/') + 1);
            window.resolveLocalFileSystemURI(fileURI, function(fileEntry) {
                fileEntry.file(function(fileObj) {
                    fileSize = fileObj.size;
                    fileType = fileObj.type;                          
                });
            }); 
        }, function(){
             alert('failed');
        }, {
            quality: 50,
            destinationType: navigator.camera.DestinationType.FILE_URI,
            sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
        });
    },