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

"@capacitor/share": "^6.0.0" build error #2133

Closed
PelnHigh opened this issue Jun 13, 2024 · 5 comments
Closed

"@capacitor/share": "^6.0.0" build error #2133

PelnHigh opened this issue Jun 13, 2024 · 5 comments

Comments

@PelnHigh
Copy link

Bug Report

Plugin(s)

@capacitor/share

Capacitor Version

6.0.0

PASTE OUTPUT HERE

Platform(s)

Android 14

Current Behavior

Expected Behavior

Code Reproduction

                                                                                                java.lang.RuntimeException: Unable to start activity ComponentInfo{com.anhe.loda/com.anhe.loda.MainActivity}: java.lang.SecurityException: com.xxx.xxx: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

Other Technical Details

Additional Context

@dmorfav
Copy link

dmorfav commented Jul 22, 2024

Hello, I have the same problem in an Ionic Angular App where I use version 5.0.7 of the plugin after increasing the values ​​of

variables.gradle

compileSdkVersion
targetSdkVersion

from API level 33 to API level 34

package.json

"@angular/animations": "17.3.10",
    "@angular/cdk": "17.3.10",
    "@angular/common": "17.3.10",
    "@angular/core": "17.3.10",
    "@capacitor/android": "^5.7.5",
    "@capacitor/app": "^5.0.7",
    "@capacitor/camera": "^5.0.9",
    "@capacitor/clipboard": "^5.0.7",
    "@capacitor/core": "^5.7.5",
    "@capacitor/device": "^5.0.7",
    "@capacitor/filesystem": "^5.2.1",
    "@capacitor/geolocation": "^5.0.7",
    "@capacitor/haptics": "^5.0.7",
    "@capacitor/ios": "^5.7.5",
    "@capacitor/keyboard": "^5.0.8",
    "@capacitor/local-notifications": "^5.0.7",
    "@capacitor/network": "^5.0.7",
    "@capacitor/preferences": "^5.0.7",
    "@capacitor/screen-orientation": "^5.0.7",
    "@capacitor/share": "^5.0.7",

Android Error

Exception java.lang.RuntimeException:
    at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4164)
    at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:4322)
    at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:103)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:139)
    at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:96)
    at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2685)
    at android.os.Handler.dispatchMessage (Handler.java:106)
    at android.os.Looper.loopOnce (Looper.java:230)
    at android.os.Looper.loop (Looper.java:319)
    at android.app.ActivityThread.main (ActivityThread.java:8919)
    at java.lang.reflect.Method.invoke
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:578)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)
Caused by java.lang.SecurityException:
    at android.os.Parcel.createExceptionOrNull (Parcel.java:3069)
    at android.os.Parcel.createException (Parcel.java:3053)
    at android.os.Parcel.readException (Parcel.java:3036)
    at android.os.Parcel.readException (Parcel.java:2978)
    at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature (IActivityManager.java:6157)
    at android.app.ContextImpl.registerReceiverInternal (ContextImpl.java:1913)
    at android.app.ContextImpl.registerReceiver (ContextImpl.java:1853)
    at android.app.ContextImpl.registerReceiver (ContextImpl.java:1841)
    at android.content.ContextWrapper.registerReceiver (ContextWrapper.java:772)
    at android.content.ContextWrapper.registerReceiver (ContextWrapper.java:772)
    at com.capacitorjs.plugins.share.SharePlugin.load (SharePlugin.java:44) <--------CRASH HERE
    at com.getcapacitor.PluginHandle.loadInstance (PluginHandle.java:115)
    at com.getcapacitor.PluginHandle.load (PluginHandle.java:105)
    at com.getcapacitor.PluginHandle.<init> (PluginHandle.java:65)
    at com.getcapacitor.Bridge.registerPlugin (Bridge.java:664)
    at com.getcapacitor.Bridge.registerAllPlugins (Bridge.java:620)
    at com.getcapacitor.Bridge.<init> (Bridge.java:218)
    at com.getcapacitor.Bridge.<init>
    at com.getcapacitor.Bridge$Builder.create (Bridge.java:1539)
    at com.getcapacitor.BridgeActivity.load (BridgeActivity.java:42)
    at com.getcapacitor.BridgeActivity.onCreate (BridgeActivity.java:36)
    at com.uve.street.MainActivity.onCreate (MainActivity.java:10)
    at android.app.Activity.performCreate (Activity.java:8975)
    at android.app.Activity.performCreate (Activity.java:8944)
    at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1456)
    at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4146)
Caused by android.os.RemoteException: Remote stack trace:
    at com.android.server.am.ActivityManagerService.registerReceiverWithFeature (ActivityManagerService.java:16680)
    at android.app.IActivityManager$Stub.onTransact$registerReceiverWithFeature$ (IActivityManager.java:11613)
    at android.app.IActivityManager$Stub.onTransact (IActivityManager.java:2961)
    at com.android.server.am.ActivityManagerService.onTransact (ActivityManagerService.java:3199)
    at android.os.Binder.execTransactInternal (Binder.java:1375)
 @Override
    public void load() {
        broadcastReceiver =
            new BroadcastReceiver() {
                @Override
                public void onReceive(Context context, Intent intent) {
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
                        chosenComponent = intent.getParcelableExtra(Intent.EXTRA_CHOSEN_COMPONENT, ComponentName.class);
                    } else {
                        chosenComponent = getParcelableExtraLegacy(intent, Intent.EXTRA_CHOSEN_COMPONENT);
                    }
                }
            }; <----- CRASH HERE
        ContextCompat.registerReceiver(
            getContext(),
            broadcastReceiver,
            new IntentFilter(Intent.EXTRA_CHOSEN_COMPONENT),
            ContextCompat.RECEIVER_EXPORTED
        );
    }

I have seen that it is also reported in this github issue

and my current concern is this message from google
image

@Ionitron
Copy link
Collaborator

This issue needs more information before it can be addressed.
In particular, the reporter needs to provide a minimal sample app that demonstrates the issue.
If no sample app is provided within 15 days, the issue will be closed.

Please see the Contributing Guide for how to create a Sample App.

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 💙

@simeonApproppo
Copy link

According this commit it should be fixed in 6.0.2:
f5ca8e0

Copy link

ionitron-bot bot commented Sep 11, 2024

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 11, 2024
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

5 participants