react-native-crisp-chat-sdk icon indicating copy to clipboard operation
react-native-crisp-chat-sdk copied to clipboard

Android Manifest merger failed with multiple errors

Open NxsHbb opened this issue 10 months ago • 14 comments

I installed crisp in the react native project. It worked fine with IOS but it is failing with the following error in Android.

Task :app:processDebugMainManifest FAILED

See https://developer.android.com/r/studio-ui/build/manifest-merger for more information about the manifest merger.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings 112 actionable tasks: 2 executed, 110 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

/Users/username/appname/android/app/src/debug/AndroidManifest.xml:43:9-51 Error: Attribute meta-data#com.google.firebase.messaging.default_notification_icon@resource value=(@drawable/ic_small_icon) from AndroidManifest.xml:43:9-51 is also present at [im.crisp:crisp-sdk:2.0.9] AndroidManifest.xml:77:13-69 value=(@drawable/crisp_sdk_notification_icon). Suggestion: add 'tools:replace="android:resource"' to element at AndroidManifest.xml:41:7-43:54 to override. /Users/username/appname/android/app/src/debug/AndroidManifest.xml:40:13-44 Error: Attribute meta-data#com.google.firebase.messaging.default_notification_color@resource value=(@color/white) from [:react-native-firebase_messaging] AndroidManifest.xml:40:13-44 is also present at [im.crisp:crisp-sdk:2.0.9] AndroidManifest.xml:80:13-67 value=(@color/crisp_sdk_theme_blue_regular). Suggestion: add 'tools:replace="android:resource"' to element at AndroidManifest.xml:38:9-40:47 to override. /Users/username/dev/appname/android/app/src/debug/AndroidManifest.xml:34:13-33 Error: Attribute meta-data#firebase_messaging_auto_init_enabled@value value=(true) from [:react-native-firebase_messaging] AndroidManifest.xml:34:13-33 is also present at [im.crisp:crisp-sdk:2.0.9] AndroidManifest.xml:83:13-34 value=(false). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:32:9-34:36 to override.

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:processDebugMainManifest'.

Manifest merger failed with multiple errors, see logs

React Native: 0.72.4

Here's list of my dependencies : "@flyerhq/react-native-chat-ui": "^1.4.3", "@notifee/react-native": "^7.8.2", "@react-native-async-storage/async-storage": "^1.19.6", "@react-native-clipboard/clipboard": "^1.14.0", "@react-native-community/push-notification-ios": "^1.11.0", "@react-native-firebase/app": "^20.3.0", "@react-native-firebase/messaging": "^20.3.0", "@react-native-masked-view/masked-view": "^0.3.1", "@react-navigation/bottom-tabs": "^6.5.9", "@react-navigation/native": "^6.1.7", "@react-navigation/native-stack": "^6.9.13", "@rneui/base": "^4.0.0-rc.8", "@rneui/themed": "^4.0.0-rc.8", "apisauce": "^3.0.1", "formik": "^2.4.3", "moment": "^2.30.1", "moment-timezone": "^0.5.45", "react": "18.2.0", "react-native": "0.72.4", "react-native-crisp-chat-sdk": "^0.16.0", "react-native-gesture-handler": "^2.16.1", "react-native-image-picker": "^7.1.2", "react-native-keyboard-aware-scroll-view": "^0.9.5", "react-native-linear-gradient": "^2.8.3", "react-native-permissions": "^4.1.5", "react-native-push-notification": "^8.1.1", "react-native-reanimated": "^3.15.0", "react-native-render-html": "^6.3.4", "react-native-safe-area-context": "^4.7.2", "react-native-screens": "^3.25.0", "react-native-skeleton-placeholder": "^5.2.4", "react-native-splash-screen": "^3.3.0", "react-native-svg": "^14.1.0", "react-native-toast-message": "^2.2.1", "react-native-vector-icons": "^10.0.0", "react-native-webview": "^13.8.1", "socket.io-client": "^4.8.1", "yup": "^1.2.0"

Here's my .../main/AndroidMenifest.xml content

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
    <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize"
        android:exported="true">
        <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="appscheme" />
        </intent-filter>
      </activity>
      <meta-data
        android:name="com.google.firebase.messaging.default_notification_channel_id"
        android:value="@string/default_notification_channel_id"
        tools:replace="android:value"/>
      <meta-data
        android:name="com.dieam.reactnativepushnotification.channel_create_default"
        android:value="true"/>
      <meta-data
        android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@drawable/ic_small_icon" />
      <meta-data
        android:name="com.google.firebase.messaging.notification_color"
        android:resource="@color/app_gold"/> 
    </application>
</manifest>

Here's my .../debug/AndroidMenifest.xml content

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

    <application
        android:usesCleartextTraffic="true"
        tools:targetApi="28"
        tools:ignore="GoogleAppIndexingWarning">
        <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
    </application>
</manifest>

How can i solve it?

NxsHbb avatar Jan 22 '25 07:01 NxsHbb

Hello !

We got incompatibility reports with @react-native-firebase.

It's on the way to be fixed

baptistejamin avatar Jan 22 '25 09:01 baptistejamin

Can anybody give me a temporary workaround so that i can continue using it. I actually do not need push notification for crisp chat. Is there any workaround that i can use?

NxsHbb avatar Jan 22 '25 09:01 NxsHbb

@NxsHbb Add this to your AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools">

<application
            android:name=".MainApplication"
           ...
            
             <meta-data
                tools:replace="android:value"
                android:name="firebase_analytics_collection_enabled"
                android:value="true" />

rodrigo-junqueira avatar Jan 23 '25 00:01 rodrigo-junqueira

@rodrigo-junqueira

I've tried putting it in my AndroidManifest.xml file (both debug and main). No use. Same error.

I've added my AndroidManifest.xml file content in the detail section. Can you have a look please?

NxsHbb avatar Jan 23 '25 07:01 NxsHbb

@NxsHbb Like this?

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

    <application
        android:usesCleartextTraffic="true"
        tools:targetApi="28"
        tools:ignore="GoogleAppIndexingWarning">
         <meta-data
                tools:replace="android:value"
                android:name="firebase_analytics_collection_enabled"
                android:value="true" />
        <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
    </application>
</manifest>

rodrigo-junqueira avatar Jan 23 '25 10:01 rodrigo-junqueira

I have the same issue. Any workaround until it's fixed?

dackom avatar Jan 24 '25 17:01 dackom

Downgrade to 0.15.2, doesn't have the push stuff in it and builds perfectly fine.

astanb avatar Jan 27 '25 14:01 astanb

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<application
    android:usesCleartextTraffic="true"
    tools:targetApi="28"
    tools:ignore="GoogleAppIndexingWarning">
     <meta-data
            tools:replace="android:value"
            android:name="firebase_analytics_collection_enabled"
            android:value="true" />
    <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
</application>

@rodrigo-junqueira Yes sir. Here's what i've tried :

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
    <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme"
      android:usesCleartextTraffic="true"
      tools:targetApi="28"
      tools:ignore="GoogleAppIndexingWarning">
      
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize"
        android:exported="true">
        <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="yeamazingrewards" />
        </intent-filter>
      </activity>
        <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
      <meta-data
        tools:replace="android:value"
        android:name="firebase_analytics_collection_enabled"
        android:value="true" />
      <meta-data
        android:name="com.google.firebase.messaging.default_notification_channel_id"
        android:value="@string/default_notification_channel_id"
        tools:replace="android:value"/>
      <meta-data
        android:name="com.dieam.reactnativepushnotification.channel_create_default"
        android:value="true"/>
      <meta-data
        android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@drawable/ic_small_icon" />
      <meta-data
        android:name="com.google.firebase.messaging.notification_color"
        android:resource="@color/app_gold"/> 
      
    </application>
</manifest>

NxsHbb avatar Jan 28 '25 09:01 NxsHbb

Hi,

I'm the developer behind the Crisp Android SDK.

This issue has already been reported to us for a native app on our own repo and @baptistejamin told me about this same issue reported by you on React Native.

I let you read how to fix it in the #202 comment I already wrote. We've also added a Disclaimer section at the top of the Notifications article of our wiki to let you know of Firebase default values we set, why an how to override them.

Doc1faux avatar Jan 30 '25 14:01 Doc1faux

+1

enchorb avatar Jan 30 '25 18:01 enchorb

Finally, after discussing about it with @baptistejamin, we have decided to remove any Firebase meta-data declaration in the Crisp SDK AndroidManifest.xml file, letting developers set them if needed.

We have just released a new 2.0.10 version with this update, a new version for the React Native bridge will come soon.

Doc1faux avatar Feb 06 '25 18:02 Doc1faux

Thanks @Doc1faux 🙌 Can't wait for the React Native release!

FlawaCLV avatar Feb 07 '25 13:02 FlawaCLV

I've installed version "0.16.1" Now it gives the following error on android build:

> Task :app:mergeExtDexDebug FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings
318 actionable tasks: 58 executed, 260 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
ERROR:/Users/user/.gradle/caches/transforms-3/b59d2c23f6b51b90f808eb65712cf3a7/transformed/jetified-appcompat-resources-1.7.0-runtime.jar: D8: java.lang.NullPointerException
ERROR:/Users/user/.gradle/caches/transforms-3/4af89a6341931cd2597ef861d9ce3251/transformed/appcompat-1.7.0-runtime.jar: D8: java.lang.NullPointerException

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform appcompat-resources-1.7.0.aar (androidx.appcompat:appcompat-resources:1.7.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: /Users/user/.gradle/caches/transforms-3/b59d2c23f6b51b90f808eb65712cf3a7/transformed/jetified-appcompat-resources-1.7.0-runtime.jar.
         > Error while dexing.
   > Failed to transform appcompat-1.7.0.aar (androidx.appcompat:appcompat:1.7.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: /Users/user/.gradle/caches/transforms-3/4af89a6341931cd2597ef861d9ce3251/transformed/appcompat-1.7.0-runtime.jar.
         > Error while dexing.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 38s
error Failed to install the app.
info Run CLI with --verbose flag for more details.

NxsHbb avatar Feb 19 '25 09:02 NxsHbb

Hi @NxsHbb,

androidx.appcompat:appcompat:1.7.0 is the most recent Appcompat release we can use and I don't know why it can cause build errors in your project.

Do you really need to use Gradle 9 which is not even in its RC phase? I think you could downgrade to the most recent AGP 8.8 and Gradle 8.10.2.

We currently stick to AGP 8.3.1 and Gradle 8.5, we tried recently to upgrade to the latest AGP and Gradle but we got build errors with our "FAT AAR" we need to fix.

Doc1faux avatar Feb 19 '25 10:02 Doc1faux