Search code examples
androidreact-nativeandroid-studioupgrade

Manifest merger failed in android xml file


enter image description hereI suddenly received the following error message. It is already added to the receiver, service, and activity wherever it is needed. I still get the same error and get stuck there badly

<receiver#com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver>. App 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.

Here is my manifest file

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.app" xmlns:tools="http://schemas.android.com/tools"

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
--> --> -->
  </activity>

  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="true"  />
 <!-- Branch init -->
    <meta-data
        android:name="io.branch.sdk.TestMode"
        android:value="true" />
        <!-- Branch install referrer tracking (optional) -->
    <receiver
        android:name="io.branch.referral.InstallListener"
        android:exported="true">
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>
      <!-- Add this SplashActivity -->
    <activity
    android:exported="true" 
      android:name=".SplashActivity"
      android:theme="@style/SplashTheme"
      android:label="@string/app_name">
      <intent-filter>
          <action android:name="android.intent.action.MAIN" />
          <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
      <meta-data
        android:name="io.branch.sdk.BranchKey"
        android:value="key_live_bmGyWtkyPEiSrNxgdZ8hagcpzDihXAce" />
    <meta-data
        android:name="io.branch.sdk.BranchKey.test"
        android:value="key_test_aaIB3ukyJCnNsRAfi92SCcdfstmcYAkD" />
    <meta-data  android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_notification" />

     <meta-data
 android:name="com.google.android.geo.API_KEY"
 android:value="AfevrvrtvtrtalGoZo5n3YDI"/>

Any help would be highly appreciated!!


Solution

  • This could happen because one or more of your dependencies is missing the android:exported tag in any of those elements. I actually experienced this issue a couple of days ago and had to upgrade a couple of them.

    What you can do to find out is:

    • Target any Android version < 12; one that does not require the tag.
    • Build your app.
    • Inspect your AndroidManifest with Android studio.
    • Press a button at the bottom left that reads something about "merged manifests".
    • This will show you the merged android manifest for your entire project, including dependencies'.
    • Inspect it and figure out which dependency does not conform to Android 12+ requirements.
    • Upgrade or patch any of them.