You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling the share function Share.share({}) via import { Share } from '@capacitor/share'; crashes the Android app.
E/Capacitor: Serious error executing plugin
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:121)
at com.getcapacitor.Bridge.lambda$callPluginMethod$0$com-getcapacitor-Bridge(Bridge.java:592)
at com.getcapacitor.Bridge$$ExternalSyntheticLambda5.run(Unknown Source:8)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.IllegalArgumentException: com.XXXX.XXXX: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:382)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:673)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:660)
at com.capacitorjs.plugins.share.SharePlugin.share(SharePlugin.java:115)
... 9 more
Expected Behavior
It should not crash when target >= 31.
Code Reproduction
js:
Share.share({
title: 'See cool stuff',
text: 'Really awesome thing you need to see right meow',
url: 'http://ionicframework.com/',
dialogTitle: 'Share with buddies',
});
capacitor will officially support to target SDK 31 on the next 4.0.0 release and plugins will also be updated to target SDK 31 and all the issues that targeting SDK 31 causes will be fixed.
Bug Report
Capacitor Version
@capacitor/cli: 3.4.0
@capacitor/core: 3.4.0
@capacitor/android: 3.4.0
@capacitor/ios: 3.4.0
@capacitor/share: 1.1.1
Platform(s)
Android
Current Behavior
Calling the share function
Share.share({})
viaimport { Share } from '@capacitor/share';
crashes the Android app.Expected Behavior
It should not crash when target >= 31.
Code Reproduction
js:
variables.gradle
Additional Context
https://developer.android.com/about/versions/12/behavior-changes-12
https://developer.android.com/reference/android/app/PendingIntent#FLAG_IMMUTABLE
https://github.com/qiscus/qiscus-sdk-android/releases/tag/1.3.35
The text was updated successfully, but these errors were encountered: