0

By refer to Xamarin.Android 12.0 Release Notes, I set TargetFramework to Android 12 and I able to deploy project without any problem. However, I encountered following error when I set android:targetSdkVersion to API 31 in android manifest.

ADB0010: Mono.AndroidTools.InstallFailedException: Unexpected install output: Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl204773411.tmp/base.apk (at Binary XML file line #84): com.urbanairship.accengage.PackageUpdatedReceiver: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present]

This happens only when android:targetSdkVersion set to 31 and deployed to physical device/emulator with android 12. I already added android:exported="true" to MainActivity class and classes that use intent filters. Could anyone advice me how to resolve this?

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="com.myapp.simulation" android:versionName="1.0.30" android:versionCode="110" xmlns:tools="http://schemas.android.com/tools">
  <uses-sdk android:minSdkVersion="24" android:targetSdkVersion="31" />
  <uses-permission android:name="android.permission.CALL_PHONE" />
  <uses-permission android:name="android.permission.CALL_PRIVILEGED" />
  <uses-permission android:name="android.permission.READ_CONTACTS" />
  <uses-permission android:name="android.permission.WRITE_CONTACTS" />
  <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
  <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
  <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
  <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
  <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
  <uses-permission android:name="android.permission.USE_FINGERPRINT" />
  <uses-permission android:name="android.permission.USE_BIOMETRIC" />
  <uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.INTERNET" />

  <application tools:replace="android:allowBackup" android:name="android.support.multidex.MultiDexApplication" android:icon="@drawable/launcher_icon" android:allowBackup="false" android:fullBackupOnly="false" android:label="Sample App">
    <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
    <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:enabled="true" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
      <intent-filter>
          <action android:name="com.google.android.c2dm.intent.RECEIVE" />
          <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
          <category android:name="${applicationId}" />
      </intent-filter>
    </receiver>
  </application>
</manifest>
Wei Loon Wong
  • 450
  • 1
  • 7
  • 23

1 Answers1

0

According to the error message, the PackageUpdatedReceiver in your project doesn't set a value for the android:exported. So you can try to set a value by the two following ways.

  1. Set it in the attribute of the BroadCastReceiver:

[BroadcastReceiver(Exported = true)]

  1. Set it into the application label in the AndroidManifest.xml:

Edit: For android 12, all the Services, BroadCastReceivers, Activity classes need to declare the value for the android:exported. So update the three part sdk to the last version.

Liyun Zhang - MSFT
  • 8,271
  • 1
  • 2
  • 14