Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xamarin.forms (android) cannot update app in appstore "android:exported" attribute missing

as of today something must have changed because we cannot update our app in the appstore.

we are given this error upon upload:

Warning: If an activity, service, or broadcast receiver uses intent filters and doesn't have an explicitly-declared value for android:exported, your app can't be installed on a device that runs Android 12 or higher.

In the docs is gives this example on how to fix this:

<service android:name="com.example.app.backgroundService"
         android:exported="false">
    <intent-filter>
        <action android:name="com.example.app.START_BACKGROUND" />
    </intent-filter>
</service>

The problem is that this is regarding java and android studio but doesnt translate well into xamarin.forms.

This is my manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.172" package="com.interiorcircle.interiorcircledroid" android:installLocation="auto" android:versionCode="329">
    <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="31" />
    <application android:label="Interior Circle" android:theme="@style/MainTheme" android:icon="@mipmap/launcher_foreground">
        <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
        </provider>
        <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="asd" />
    </application>
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-feature android:name="android.hardware.location" android:required="false" />
    <uses-feature android:name="android.hardware.location.gps" android:required="false" />
    <uses-feature android:name="android.hardware.location.network" android:required="false" />
</manifest>

EDIT:

i have noticed int he obj folder builds that in the manifest, these here do NOT have the attribute in question:

<service android:name="crc6494e14b9856016c30.PNFirebaseMessagingService">
      <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
      </intent-filter>
    </service>
    <receiver android:name="crc6494e14b9856016c30.PushNotificationActionReceiver" />
    <receiver android:name="crc6494e14b9856016c30.PushNotificationDeletedReceiver" />
    <activity android:configChanges="orientation|screenSize|uiMode" android:name="crc646957603ea1820544.MediaPickerActivity" />

has anyone made a similar experience and maybe already solved this issue?

like image 563
innom Avatar asked Jun 30 '26 01:06

innom


1 Answers

I set this on the service attribute...

[Service(Exported = true or false)]

This resulted in the property being added to the generated manifest file automatically.

like image 79
Ian Warburton Avatar answered Jul 01 '26 15:07

Ian Warburton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!