-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Messaging - Expo EAS build failed (Android) #8165
Comments
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 |
I was able to solve the problem in the following way const { withAndroidManifest } = require('@expo/config-plugins');
/**
* Custom Expo plugin to resolve manifest conflicts with Firebase Messaging.
* Specifically, this plugin ensures that the meta-data for
* `com.google.firebase.messaging.default_notification_color` is correctly
* configured with `tools:replace="android:resource"` to prevent build errors.
*/
module.exports = function withNotificationToolsReplace(config) {
return withAndroidManifest(config, (config) => {
const androidManifest = config.modResults;
// Ensure the namespace 'tools' is added to the manifest to support 'tools:replace' attributes
if (!androidManifest.manifest.$['xmlns:tools']) {
androidManifest.manifest.$['xmlns:tools'] = 'http://schemas.android.com/tools';
}
const application = androidManifest.manifest.application[0];
application['meta-data'] ??= []; // Ensure 'meta-data' exists in the application node
// Check if the meta-data for `default_notification_color` already exists
const metaData = application['meta-data'].find(
(item) =>
item['$']['android:name'] ===
'com.google.firebase.messaging.default_notification_color'
);
if (metaData) {
// If it exists, add or update the 'tools:replace' attribute to resolve conflicts
metaData['$']['tools:replace'] = 'android:resource';
} else {
// If it does not exist, create the meta-data entry with the required attributes
application['meta-data'].push({
$: {
'android:name': 'com.google.firebase.messaging.default_notification_color',
'android:resource': '@color/notification_icon_color',
'tools:replace': 'android:resource',
},
});
}
// Return the updated config
return config;
});
}; Similar logic is defined in the library plugin. Apparently, it does not work correctly. |
@WhidRubeld - ah! I just looked at the plugin. In fact it does add the tools namespace and the tools replace, or at least it intends to
I cannot understand why - with an existing plugin that has this specific purpose and is hosted here for community use such that you may eventually benefit from others' work as well, you did not propose a fix to the plugin, but made a new one? If you proposed a PR to the plugin, I'd merge it without question... |
@mikehardy Yes, I will do PR this week |
Fantastic! Hopefully it's not too awful, I mean...it existed! It used to work? AndroidManifest hasn't changed that much, it's XML after all... strange it's not working now |
Yep, the problem was previously solved as described in the old Issue. With the following dependencies combined:
After updating to the latest versions - the problem has returned. It would be nice to identify the root of the problem... |
Hi I am also getting this error with my expo managed android builds, is there any update on this? |
@sylv1ah no update, I imagine if someone (could be you!) examines the expo config plugin here to see why it's not doing it's job and fixes it by submitting a PR, we'll see comments here indicating the same or the issue will close as the linked PR is merged+released We need a motivated expo person to submit a PR though as expo plugins support is community maintained Future folks looking for updates, please use the subscribe button and/or add a reaction to the issue, +1s or asking for updates vs posting a PR isn't progress, only posting a PR is progress. Thanks |
Managed to resolve this issue by updating all the react-native-firebase dependencies to:
|
+1 |
1 similar comment
+1 |
The problem persists for versions 21.6.0 inclusive. I'll try to make MR in the coming days |
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.Old problem #7841
Project Files
Javascript
Click To Expand
package.json
:firebase.json
for react-native-firebase v6:{ "react-native": {} }
Environment
Click To Expand
react-native info
output: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"
TypeScript
?"typescript": "~5.3.3"
React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: