Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera Plugin crashes app on restoreState (NullPointerException) #658

Closed
dnarvaez27 opened this issue Oct 15, 2021 · 4 comments
Closed

Camera Plugin crashes app on restoreState (NullPointerException) #658

dnarvaez27 opened this issue Oct 15, 2021 · 4 comments

Comments

@dnarvaez27
Copy link

Bug Report

Plugin(s)

  • Camera

Capacitor Version

Installed Dependencies:

@capacitor/ios: not installed
@capacitor/core: 3.2.4 
@capacitor/cli: 3.2.4 
@capacitor/android: 3.2.4

[success] Android looking great! 👌

Platform(s)

  • Android

Current Behavior

We have seen crashes in production related to a NullPointerException on the restoreState of the CameraPlugin. The setup for the Camera is the following:

photo = await Camera.getPhoto({
          quality: 75,
          resultType: CameraResultType.Base64,
          promptLabelHeader: '...',
          promptLabelPicture: '...',
          promptLabelPhoto: '...',
          promptLabelCancel: '...',
          source: CameraSource.Prompt,
});

Expected Behavior

Able to take a photo with the camera or pick a photo with no problem.

Code Reproduction

N/A

Other Technical Details

N/A

Additional Context

Works perfect when testing on our phones, but there has been more than 200 crashes in production in the last three days with the following stack trace:

java.lang.NullPointerException: 
  at com.capacitorjs.plugins.camera.CameraPlugin.restoreState (CameraPlugin.java:618)
  at com.getcapacitor.Bridge.restoreInstanceState (Bridge.java:811)
  at com.getcapacitor.Bridge$Builder.create (Bridge.java:1279)
  at com.getcapacitor.BridgeActivity.load (BridgeActivity.java:72)
  at com.getcapacitor.BridgeActivity.onStart (BridgeActivity.java:110)
  at android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1435)
  at android.app.Activity.performStart (Activity.java:8222)
  at android.app.ActivityThread.handleStartActivity (ActivityThread.java:3818)
  at android.app.servertransaction.TransactionExecutor.performLifecycleSequence (TransactionExecutor.java:221)
  at android.app.servertransaction.TransactionExecutor.cycleToPath (TransactionExecutor.java:201)
  at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:173)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2307)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:246)
  at android.app.ActivityThread.main (ActivityThread.java:8512)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)

This is happening for android versions 7.0 7.1, 8.0, 8.1, 9, 10, 11.

@Ionitron
Copy link
Collaborator

This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue.

Please see the Contributing Guide for how to create a Code Reproduction.

Thanks!
Ionitron 💙

@Ionitron
Copy link
Collaborator

It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot.

Have a great day!
Ionitron 💙

@hermitdemschoenenleben
Copy link

I see the same error in production with > 100 occurences, but I'm also unable to reproduce the issue. @dnarvaez27 did you find any workaround?

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 30, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants