Kyle created CB-13200:
-------------------------

             Summary: Android app crash when accessing camera in release build 
only
                 Key: CB-13200
                 URL: https://issues.apache.org/jira/browse/CB-13200
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-plugin-camera
            Reporter: Kyle
            Priority: Blocker


Recent changes to the camera plugin were added to use FileProvider instead of 
"file://" URIs to fix this bug originally. The changes seem to work when 
building and testing a debug apk, but (at least in my case) fail upon using a 
release build. Is anyone else seeing this?

My project has been upgraded to the latest of cordova and the camera plugin:
> cordova-plugin-camera 2.4.1 "Camera"
> cordova -v
> "7.0.1"

If I run the project through Android Studio, everything works great. If I use 
"gradlew assembleRelease" or build a signed apk via Android Studio's interface, 
the app crashes.

The crash occurs after choosing "Camera" from the dialog for where to source a 
photo, and then after clicking "Allow" on the Android permissions prompt 
(assuming you haven't given permissions yet.)

Below is the full stack trace of one of the recent crashes. I believe this is 
the same exception and stack trace as the original crash that the recent 
changes in the camera plugin were fixing.

Please let me know if you need additional details.

Stack Trace:
{code}
java.lang.RuntimeException: Failure delivering result 
ResultInfo{who=@android:requestPermissions:, request=0, result=-1, data=Intent 
{ act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity 
{edu.okstate.traditions/com.essenzasoftware.essenzaapp.MainActivity}: 
java.lang.NullPointerException: Attempt to invoke virtual method 
'android.content.res.XmlResourceParser 
android.content.pm.PackageItemInfo.loadXmlMetaData(android.content.pm.PackageManager,
 java.lang.String)' on a null object reference
                                                       at 
android.app.ActivityThread.deliverResults(ActivityThread.java:4090)
                                                       at 
android.app.ActivityThread.handleSendResult(ActivityThread.java:4133)
                                                       at 
android.app.ActivityThread.-wrap20(ActivityThread.java)
                                                       at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1534)
                                                       at 
android.os.Handler.dispatchMessage(Handler.java:102)
                                                       at 
android.os.Looper.loop(Looper.java:154)
                                                       at 
android.app.ActivityThread.main(ActivityThread.java:6121)
                                                       at 
java.lang.reflect.Method.invoke(Native Method)
                                                       at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
                                                       at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
                                                    Caused by: 
java.lang.NullPointerException: Attempt to invoke virtual method 
'android.content.res.XmlResourceParser 
android.content.pm.PackageItemInfo.loadXmlMetaData(android.content.pm.PackageManager,
 java.lang.String)' on a null object reference
                                                       at 
android.support.v4.content.FileProvider.b(SourceFile:583)
                                                       at 
android.support.v4.content.FileProvider.a(SourceFile:557)
                                                       at 
android.support.v4.content.FileProvider.a(SourceFile:399)
                                                       at 
org.apache.cordova.camera.CameraLauncher.takePicture(SourceFile:295)
                                                       at 
org.apache.cordova.camera.CameraLauncher.onRequestPermissionResult(SourceFile:1314)
                                                       at 
org.apache.cordova.CordovaInterfaceImpl.onRequestPermissionResult(SourceFile:214)
                                                       at 
com.essenzasoftware.essenzaapp.MainActivity.onRequestPermissionsResult(SourceFile:1099)
                                                       at 
android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7087)
                                                       at 
android.app.Activity.dispatchActivityResult(Activity.java:6939)
                                                       at 
android.app.ActivityThread.deliverResults(ActivityThread.java:4086)
                                                       at 
android.app.ActivityThread.handleSendResult(ActivityThread.java:4133) 
                                                       at 
android.app.ActivityThread.-wrap20(ActivityThread.java) 
                                                       at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1534) 
                                                       at 
android.os.Handler.dispatchMessage(Handler.java:102) 
                                                       at 
android.os.Looper.loop(Looper.java:154) 
                                                       at 
android.app.ActivityThread.main(ActivityThread.java:6121) 
                                                       at 
java.lang.reflect.Method.invoke(Native Method) 
                                                       at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889) 
                                                       at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779) 
{code}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to