invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.73k stars 2.22k forks source link

Messaging - Expo EAS build failed (Android) #8165

Open WhidRubeld opened 18 hours ago

WhidRubeld commented 18 hours ago

Issue

Expo-managed Android project build error using EAS. The error is due to a conflict with the expo-notifications library when setting a manifest parameter.

> Task :app:processDebugMainManifest FAILED
See https://developer.android.com/r/studio-ui/build/manifest-merger for more information about the manifest merger.
/home/expo/workingdir/build/android/app/src/debug/AndroidManifest.xml:17:88-137 Error:
    Attribute meta-data#com.google.firebase.messaging.default_notification_color@resource value=(@color/notification_icon_color) from AndroidManifest.xml:17:88-137
    is also present at [:react-native-firebase_messaging] AndroidManifest.xml:40:13-44 value=(@color/white).
    Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.
> Task :react-native-firebase_crashlytics:compileDebugJavaWithJavac
Note: /home/expo/workingdir/build/node_modules/@react-native-firebase/crashlytics/android/src/main/java/io/invertase/firebase/crashlytics/ReactNativeFirebaseCrashlyticsModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-firebase_analytics:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
>
Manifest merger failed : Attribute meta-data#com.google.firebase.messaging.default_notification_color@resource value=(@color/notification_icon_color) from AndroidManifest.xml:17:88-137
    is also present at [:react-native-firebase_messaging] AndroidManifest.xml:40:13-44 value=(@color/white).
    Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.
* 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/.

Old problem https://github.com/invertase/react-native-firebase/issues/7841


Project Files

Javascript

Click To Expand #### `package.json`: ```json { ... "dependencies": { ... "@react-native-firebase/analytics": "^21.0.0", "@react-native-firebase/app": "^21.0.0", "@react-native-firebase/crashlytics": "^21.0.0", "@react-native-firebase/in-app-messaging": "^21.0.0", "@react-native-firebase/installations": "^21.0.0", "@react-native-firebase/messaging": "^21.0.0", ... "expo": "~52.0.7", ... "expo-notifications": "~0.29.8", ... "react-native": "0.76.3", ... }, ... } ``` #### `firebase.json` for react-native-firebase v6: ```json { "react-native": {} } ```

Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 15.0.1 CPU: (11) arm64 Apple M3 Pro Memory: 87.75 MB / 18.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.9.0 path: ~/.nvm/versions/node/v20.9.0/bin/node Yarn: version: 1.22.22 path: ~/.nvm/versions/node/v20.9.0/bin/yarn npm: version: 10.1.0 path: ~/.nvm/versions/node/v20.9.0/bin/npm Watchman: version: 2022.07.04.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.11.3 path: /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 24.1 - iOS 18.1 - macOS 15.1 - tvOS 18.1 - visionOS 2.1 - watchOS 11.1 Android SDK: Not Found IDEs: Android Studio: 2024.2 AI-242.23339.11.2421.12483815 Xcode: version: 16.1/16B40 path: /usr/bin/xcodebuild Languages: Java: version: 11.0.17 path: /usr/bin/javac Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: "@react-native-community/cli": installed: 15.1.2 wanted: ^15.1.2 react: installed: 18.3.1 wanted: 18.3.1 react-native: installed: 0.76.3 wanted: 0.76.3 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: Not found newArchEnabled: Not found iOS: hermesEnabled: Not found newArchEnabled: Not found ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [x] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `@react-native-firebase/app": "^21.0.0"` - **`Firebase` module(s) you're using that has the issue:** - `"@react-native-firebase/messaging": "^21.0.0"` - **Are you using `TypeScript`?** - `"typescript": "~5.3.3"`


mikehardy commented 14 hours ago

You'll need to either alter the config plugin here for messaging or there for expo-notifications to do as it says: add the tools XML namespace to the AndroidManifest file (if not there already) and mark that property as tools:replace

The Expo plugins here are community maintained by interested Expo users, none of the maintainers use Expo so we rely on Expo users to keep them working. Bearing that in mind we'll need a PR from someone that uses it so they test it well and know it works. We can merge and release easily if someone proposes a PR