When Xamarin.Android is set to Android 12, I received
"You uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter, but without the 'android:exported' property set. This file can't be installed on Android 12 or higher. See: developer.android.com/about/versions/12/behavior-changes-12#exported"
error while uploading the APK to the Google Play Console for new release.
I have added the the Exported attribute to my activities and services, yet still setting this error.
[Activity(Label = "@string/AppDrawerName", Icon = "@mipmap/ic_launcher", RoundIcon = "@mipmap/ic_launcher_round", Theme = "@style/MainTheme", MainLauncher = true, Exported = false, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Portrait)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
Service
[Service(Exported = true)]
public class BarcodeService : IBarcodeService
{
From the compile output I can see the message below
Namespace 'com.google.android.gms.stats' used in: AndroidManifest.xml, AndroidManifest.xml.
android:exported needs to be explicitly specified for element <service#crc640921eac73192168e.PNMessagingService>. 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.
Then I go into the "obj/Debug" folder to open the Manifest, I can see the below service is auto generated
<service android:name="crc640921eac73192168e.PNMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
Anybody know how can I set [Service(Exported = true)]
for this service since it's auto generated?
obj/Debug/Android
folder and see what is actually being exported – Tyner