capacitor-filesharer icon indicating copy to clipboard operation
capacitor-filesharer copied to clipboard

Bug: NullPointerException in "handleOnActivityResult"

Open carsten-klaffke opened this issue 4 years ago • 1 comments

From the crash reports in Google Play Console, I regularly see a NullPointerException in this Plugin.

Capacitor version:

@capacitor/cli 2.3.0 @capacitor/android 2.3.0 @capacitor/core 2.3.0 @capacitor/ios 2.3.0 @capacitor/electron not installed

java.lang.RuntimeException: 
  at android.app.ActivityThread.performResumeActivity (ActivityThread.java:4053)
  at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:4085)
  at android.app.servertransaction.ResumeActivityItem.execute (ResumeActivityItem.java:51)
  at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:145)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:70)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1984)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:216)
  at android.app.ActivityThread.main (ActivityThread.java:7211)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:975)
Caused by: java.lang.RuntimeException: 
  at android.app.ActivityThread.deliverResults (ActivityThread.java:4683)
  at android.app.ActivityThread.performResumeActivity (ActivityThread.java:4042)
Caused by: java.lang.NullPointerException: 
  at com.byteowls.capacitor.filesharer.FileSharerPlugin.handleOnActivityResult (FileSharerPlugin.java:110)
  at com.getcapacitor.Bridge.onActivityResult (Bridge.java:771)
  at com.getcapacitor.BridgeActivity.onActivityResult (BridgeActivity.java:216)
  at android.app.Activity.dispatchActivityResult (Activity.java:7806)
  at android.app.ActivityThread.deliverResults (ActivityThread.java:4676)

It seems like the PluginCall returned from getSavedCall() can be null. Is this a known issue? Do you know how this situation can occur?

Library version:

  • 2.0.0

Your Plugin Configuration

{
import {Plugins} from '@capacitor/core';
const {Share} = Plugins;
                                            
Plugins.FileSharer.share({
                                                filename: "mindlib-export.opml",
                                                base64Data: btoa(unescape(encodeURIComponent(result))),
                                                contentType: "text/plain",
                                            }) ...
}

Affected Platform(s):

  • Android

carsten-klaffke avatar Sep 09 '20 10:09 carsten-klaffke

I released the new version 3.0.0 today

If you can and it is still relevant please test this issue with the new version. (Capacitor 3.0.0 required)

I keep this issue open a few days and close it afterwards if there is no feedback.

BR Michael

moberwasserlechner avatar Sep 23 '21 16:09 moberwasserlechner

Closed as outdated.

moberwasserlechner avatar Sep 18 '22 18:09 moberwasserlechner