Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native - gradle, manifest merge error

When trying to build my android react native app, im getting this error

Execution failed for task ':app:processReleaseMainManifest'.
> Manifest merger failed : Attribute meta-data#org.unimodules.core.AppLoader#react-native-headless@value value=(org.unimodules.adapters.react.apploader.RNHeadlessAppLoader) from [:unimodules-react-native-adapter] AndroidManifest.xml:14:13-88
        is also present at [:expo-modules-core] AndroidManifest.xml:14:13-86 value=(expo.modules.adapters.react.apploader.RNHeadlessAppLoader).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:12:9-14:91 to override.
like image 821
Guillaume Theret Avatar asked Nov 02 '21 12:11

Guillaume Theret


Video Answer


2 Answers

For now I know that in my case it is that I have conflict between two manifest files in node_modules folder:

> cd <YOUR_PROJECT_DIR>/node_modules   
> grep -r -i RNHeadlessAppLoader | grep AndroidMan

./expo-modules-core/android/src/main/AndroidManifest.xml:
android:value="expo.modules.adapters.react.apploader.RNHeadlessAppLoader" />
   
./@unimodules/react-native-adapter/android/src/main/AndroidManifest.xml:   
android:value="org.unimodules.adapters.react.apploader.RNHeadlessAppLoader"/>

Solution

  • Add such xmlns:tools="http://schemas.android.com/tools" attribute to <manifest> tag in <YOUR_PROJECT_DIR>/android/app/src/main/AndroidManifest.xml
  • Add such tag in application section of your manifest file
<meta-data
tools:replace="android:value" 
android:name="org.unimodules.core.AppLoader#react-native-headless"
android:value="org.unimodules.adapters.react.apploader.RNHeadlessAppLoader"/>
like image 148
Rad Avatar answered Oct 26 '22 08:10

Rad


Updating to last expo SDK seems to be working for me (version 43). Since they replaced the react-native-unimodules package with an expo one.

like image 38
Guillaume Theret Avatar answered Oct 26 '22 09:10

Guillaume Theret