# Getting android:exported error even if it exists in AndroidManifest.xml

**URL:** <https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434>\
**Category:** Ionic Angular\
**Created:** [June 22, 2022, 5:33am UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434 "2022-06-22T05:33:49Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![CGauns](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/cgauns/32/140290_2.png) [@CGauns](https://forum.ionicframework.com/u/CGauns)\
**Post date:** [June 22, 2022, 5:33am UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/1 "2022-06-22T05:33:49Z")

</div>

After I installed `cordova-plugin-x-socialsharing` plugin into my ionic cordova project I am getting the below error when executed build command:

```auto
> Task :app:processDebugMainManifest FAILED
D:\Project\@Codes Repos\Ionic6-cordova\platforms\android\app\src\main\AndroidManifest.xml Error:
        Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

```

If I check my `AndroidManifest.xml` file, the `activity` tag already has the `android:exported="true"` property.

**AndroidManifest.xml**

```auto
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.test.testproj" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:exported="true" android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_security_config" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:exported="true" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@style/Theme.AppCompat.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <provider android:authorities="${applicationId}.fileOpener2.provider" android:exported="false" android:grantUriPermissions="true" android:name="io.github.pwlin.cordova.plugins.fileopener2.FileProvider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/opener_paths" />
        </provider>
        <receiver android:enabled="true" android:name="nl.xservices.plugins.ShareChooserPendingIntent">
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
            </intent-filter>
        </receiver>
        <provider android:authorities="${applicationId}.sharing.provider" android:exported="false" android:grantUriPermissions="true" android:name="nl.xservices.plugins.FileProvider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/sharing_paths" />
        </provider>
    </application>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-feature android:name="android.hardware.location.gps" android:required="true" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
</manifest>

```

Do I have to add the `android:exported` somewhere else as well?

**Ionic Info**

```auto
Ionic:

   Ionic CLI : 6.19.0 (C:\Users\CGauns\AppData\Roaming\nvm\v16.15.0\node_modules\@ionic\cli)
   Ionic Framework : @ionic/angular 6.1.5
   @angular-devkit/build-angular : 13.2.6
   @angular-devkit/schematics : 13.2.6
   @angular/cli : 13.2.6
   @ionic/angular-toolkit : 6.1.0

Cordova:

   Cordova CLI : 11.0.0
   Cordova Platforms : android 10.1.2
   Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 22 other plugins)

Utility:

   cordova-res : 0.15.4
   native-run (update available: 1.6.0) : 1.5.0

System:

   Android SDK Tools : 26.1.1 (D:\Android\sdk)
   NodeJS : v16.15.0 (C:\Program Files\nodejs\node.exe)
   npm : 8.5.5
   OS : Windows 10

```

---

<div class="post-metadata">

**Author:** ![syndeveloper](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@syndeveloper](https://forum.ionicframework.com/u/syndeveloper)\
**Post date:** [June 29, 2022, 11:56am UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/2 "2022-06-29T11:56:06Z")

</div>

![Screenshot from 2022-06-25 14-52-19](https://global.discourse-cdn.com/ionicframework/original/3X/a/0/a07d577034ba05ca35b39f2415e3d27a21ab0ebb.png)  
I’m facing the same issue, did you find any solution yet?

---

<div class="post-metadata">

**Author:** ![CGauns](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/cgauns/32/140290_2.png) [@CGauns](https://forum.ionicframework.com/u/CGauns)\
**Post date:** [June 29, 2022, 12:10pm UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/3 "2022-06-29T12:10:07Z")

</div>

hi @syndeveloper I used older version of `cordova-plugin-x-socialsharing` and not the latest one.

I used version `5.3.1` as this was working on my **ionic 3** app.

Please note that I was getting error while building and not while uploading the APK.

---

<div class="post-metadata">

**Author:** ![syndeveloper](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@syndeveloper](https://forum.ionicframework.com/u/syndeveloper)\
**Post date:** [June 29, 2022, 12:12pm UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/4 "2022-06-29T12:12:55Z")

</div>

@CGauns oh that fixed the problem?  
currently i am using “cordova-plugin-x-socialsharing” spec=“^5.6.2”  
should i have to update it ?

---

<div class="post-metadata">

**Author:** ![CGauns](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/cgauns/32/140290_2.png) [@CGauns](https://forum.ionicframework.com/u/CGauns)\
**Post date:** [June 29, 2022, 12:17pm UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/5 "2022-06-29T12:17:26Z")

</div>

Using version `5.3.1`, I was able to build and run the app. Also the sharing works. But haven’t tried uploading the app on Play store or App store.

---

<div class="post-metadata">

**Author:** ![syndeveloper](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@syndeveloper](https://forum.ionicframework.com/u/syndeveloper)\
**Post date:** [June 29, 2022, 12:35pm UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/6 "2022-06-29T12:35:01Z")

</div>

@CGauns thank you! are you using android sdk 30+ ?

---

<div class="post-metadata">

**Author:** ![CGauns](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/cgauns/32/140290_2.png) [@CGauns](https://forum.ionicframework.com/u/CGauns)\
**Post date:** [June 29, 2022, 12:46pm UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/7 "2022-06-29T12:46:51Z")

</div>

I have set target sdk as 31.

---

<div class="post-metadata">

**Author:** ![vorkapps](https://avatars.discourse-cdn.com/v4/letter/v/d07c76/32.png) [@vorkapps](https://forum.ionicframework.com/u/vorkapps)\
**Post date:** [August 2, 2022, 5:58pm UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/8 "2022-08-02T17:58:43Z")

</div>

Until the plugin author makes the necessary change, you can modify the file “plugin.xml” under /node\_modules/cordova-plugin-x-socialsharing and add the android:exported=“true” there so that each time you compile, the generated manifest file for this plugin gets it:

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/a/2/a2660cf2f1e06d058074b4f7718b8263870e7e6f.png)

---

<div class="post-metadata">

**Author:** ![syndeveloper](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@syndeveloper](https://forum.ionicframework.com/u/syndeveloper)\
**Post date:** [August 4, 2022, 11:34am UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/9 "2022-08-04T11:34:06Z")

</div>

@vorkapps thank you, but we do build our project on [https://dashboard.ionicframework.com](https://dashboard.ionicframework.com)  
so we won’t be having control over the manifest file ☹

---

<div class="post-metadata">

**Author:** ![CGauns](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/cgauns/32/140290_2.png) [@CGauns](https://forum.ionicframework.com/u/CGauns)\
**Post date:** [August 8, 2022, 12:07pm UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/10 "2022-08-08T12:07:48Z")

</div>

hi @vorkapps ,

I did the change you have suggested but I am getting the same error

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/3/5/3556aa0e934ae227150fe263cd9674db3859de2e.png)

I checked the `AndroidManifest.xml` file under `\platforms\android\app\src\main` folder, `android:exported="true"` was not added. I had tried removing and adding platform.

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/b/a/bad8898258f8604d8460eee5e87c8c5ad5c73b52.png)

---

<div class="post-metadata">

**Author:** ![vorkapps](https://avatars.discourse-cdn.com/v4/letter/v/d07c76/32.png) [@vorkapps](https://forum.ionicframework.com/u/vorkapps)\
**Post date:** [August 8, 2022, 4:29pm UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/11 "2022-08-08T16:29:36Z")

</div>

hi @CGauns ,

You mentioned \platforms\android\app\src\main folder, which suggests you are not using Capacitor, so I’m not sure if my suggestion still holds, I would guess it should, as I am using Capacitor.

I checked my config.xml again, and there is another section that I had added the android:exported=“true” setting, and it’s this one: (maybe this is what made the effect)

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/3/8/38ece2951e4188d156d3e5301bb2b898d49f9ec6.png)

edit: I was going to delete this reply, as I now see it’s irrelevant to the issue… Maybe the difference is the fact that I’m using Capacitor, and something else needs to be done for cordova scenarios… Sorry I couldn’t help further…

Rgrds

---

<div class="post-metadata">

**Author:** ![CGauns](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/cgauns/32/140290_2.png) [@CGauns](https://forum.ionicframework.com/u/CGauns)\
**Post date:** [August 9, 2022, 6:02am UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/12 "2022-08-09T06:02:06Z")

</div>

hi @vorkapps

Your answer might not be related to Cordova, but it works.

I am not sure how it is working in **Capacitor** , but in **Cordova** , a separate folder called `plugins` is created in the root directory. In my case, the plugin configuration were picked from that folder. After setting the same properties in `plugins\cordova-plugin-x-socialsharing\plugin.xml` file, the issue got resolved.

Thank you for the help. 😇 👍

---

<div class="post-metadata">

**Author:** ![vorkapps](https://avatars.discourse-cdn.com/v4/letter/v/d07c76/32.png) [@vorkapps](https://forum.ionicframework.com/u/vorkapps)\
**Post date:** [August 9, 2022, 8:26am UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/13 "2022-08-09T08:26:48Z")

</div>

You marked your reply as the solution, instead of my post providing the solution 🙂

---

<div class="post-metadata">

**Author:** ![modatta](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@modatta](https://forum.ionicframework.com/u/modatta)\
**Post date:** [December 6, 2022, 12:55am UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/14 "2022-12-06T00:55:29Z")

</div>

heyy did you manage to solve this? i’m having the same issue with the ionic dashboard

---

<div class="post-metadata">

**Author:** ![Guru0401](https://avatars.discourse-cdn.com/v4/letter/g/96bed5/32.png) [@Guru0401](https://forum.ionicframework.com/u/Guru0401)\
**Post date:** [December 25, 2022, 12:42pm UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/15 "2022-12-25T12:42:04Z")

</div>

Currenty if you set minsdk version and get Android Error: Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined then I have sollution of that…

1. Open platforms/android/android.json

2. Put this line in all plugin you used. android:exported="true" or android:exported="false" (Based on your requirement)  

3. After open platforms\android\app\src\main/AndroidManifest.xml file and delete all the activity,meta-data,service,provider…all the things under \<application …\>  
—delete these all data—  
\</application?

Because we changed android.json line. So when we build again than It will auto generate with android:exported…

I spend my whole day in this error. But now I am happy because I got Sollution.

---

<div class="post-metadata">

**Author:** ![sv2k](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@sv2k](https://forum.ionicframework.com/u/sv2k)\
**Post date:** [January 10, 2023, 2:53am UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/16 "2023-01-10T02:53:23Z")

</div>

like a charm, added **android:exported="true"** on all **“xml”: "\<activity** I could find

---

<div class="post-metadata">

**Author:** ![sv2k](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@sv2k](https://forum.ionicframework.com/u/sv2k)\
**Post date:** [January 11, 2023, 2:11pm UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/17 "2023-01-11T14:11:25Z")

</div>

build and deploy went ok. When tested the installation on a device, it broke. Had to update cordova and go for android@11 platform

---

<div class="post-metadata">

**Author:** ![helpmelearn](https://avatars.discourse-cdn.com/v4/letter/h/f0a364/32.png) [@helpmelearn](https://forum.ionicframework.com/u/helpmelearn)\
**Post date:** [February 9, 2023, 7:24pm UTC](https://forum.ionicframework.com/t/getting-android-exported-error-even-if-it-exists-in-androidmanifest-xml/224434/18 "2023-02-09T19:24:41Z")

</div>

Are these are the only two options right now? Either add to the JSON or updated to android@11 ?  
Can we not put this in the config.xml and it put it in the manifest? I’m trying that and see it in the android.json but I guess not in the correct format?

I’m not finding any \<activity in anrdoid.json  
I have one provider (which gets the tag from config.xml)  
and under application for the first \<service has it (from config)  
I added it to the other \<service but still getting the error.
