Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Manifest merger failed for notifee foregroundServiceType #1108

@YourAverageTechBro

Description

@YourAverageTechBro

@notifee/react-native": "^9.0.2"
"expo": "~51.0.28"
"minSdkVersion": 34

Test device: Pixel 7a on Android 14.

Currently trying to use Notifee to register a foreground service so that I can record audio while the app is backgrounded or when the screen is turned off, but I'm running into an issue where the expo build is failing.

Here is my current AndroidManifest.xml where I have updated it to include <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE"/> and <service android:name="app.notifee.core.ForegroundService" android:foregroundServiceType="microphone"/>.

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
  <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
  <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE"/>
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
  <uses-permission android:name="android.permission.RECORD_AUDIO"/>
  <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
  <uses-permission android:name="android.permission.VIBRATE"/>
  <uses-permission android:name="android.permission.WAKE_LOCK"/>
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  <queries>
    <intent>
      <action android:name="android.intent.action.VIEW"/>
      <category android:name="android.intent.category.BROWSABLE"/>
      <data android:scheme="https"/>
    </intent>
  </queries>
  <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme">
    <meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/notification_icon_color"/>
    <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon"/>
    <meta-data android:name="expo.modules.notifications.default_notification_color" android:resource="@color/notification_icon_color"/>
    <meta-data android:name="expo.modules.notifications.default_notification_icon" android:resource="@drawable/notification_icon"/>
    <meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
    <meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
    <meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
    <service android:name="app.notifee.core.ForegroundService" android:foregroundServiceType="microphone"/>
    <activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode|locale|layoutDirection" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
      <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
      <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="myapp"/>
        <data android:scheme="com.yklabs.aiaudiorecorder"/>
        <data android:scheme="exp+audio-ai"/>
      </intent-filter>
    </activity>
    <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>
  </application>
</manifest>

And then when I try to build my application I get the following error`

> Task :app:processDebugMainManifest FAILED
/Users/dohyunkim/code/montee-expo/android/app/src/debug/AndroidManifest.xml:28:64-106 Error:
        Attribute service#app.notifee.core.ForegroundService@foregroundServiceType value=(microphone) from AndroidManifest.xml:28:64-106
        is also present at [app.notifee:core:202108261754] AndroidManifest.xml:44:13-57 value=(shortService).
        Suggestion: add 'tools:replace="android:foregroundServiceType"' to <service> element at AndroidManifest.xml to override.

See https://developer.android.com/r/studio-ui/build/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 : Attribute service#app.notifee.core.ForegroundService@foregroundServiceType value=(microphone) from AndroidManifest.xml:28:64-106
        is also present at [app.notifee:core:202108261754] AndroidManifest.xml:44:13-57 value=(shortService).
        Suggestion: add 'tools:replace="android:foregroundServiceType"' to <service> element at AndroidManifest.xml to override.

I've also tried their suggestion of add 'tools:replace="android:foregroundServiceType"' to <service> element at AndroidManifest.xml to override by updating my AndroidManifest.xml with

<service android:name="app.notifee.core.ForegroundService" android:foregroundServiceType="microphone" tools:replace="android:foregroundServiceType"/>

but I was still getting build failures.

Any idea on how to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions