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

Open
PelnHigh opened this issue Jun 13, 2024 · 1 comment
Open

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

PelnHigh opened this issue Jun 13, 2024 · 1 comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants