-
Notifications
You must be signed in to change notification settings - Fork 85
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
manifestPlaceholders: appAuthRedirectScheme missing from android/app/build.gradle causing build errors #2743
Comments
Hey, It seems like it is some sort of bug in this package's config plugin. There shouldn't be a need to substitute a placeholder for this value from the |
It started to occur for you after installing |
I see that probably the same issue occurs for |
It seems like what you can do is add a config plugin that looks like this (I didn't test it, I just generated it with chat gpt): // withAppRedirectScheme.js
const { withAppBuildGradle } = require('@expo/config-plugins');
// Function to add the redirect scheme to build.gradle
const addRedirectSchemeToGradle = (config, redirectScheme) => {
return withAppBuildGradle(config, config => {
if(config.modResults.language === 'groovy') {
// Using regex to insert manifestPlaceholders
let gradleContent = config.modResults.contents;
const manifestPlaceholders = `manifestPlaceholders = [appAuthRedirectScheme: "${redirectScheme}"]`;
const defaultConfigPattern = /defaultConfig \{/;
if (!gradleContent.match(manifestPlaceholders)) {
gradleContent = gradleContent.replace(defaultConfigPattern, `defaultConfig {\n ${manifestPlaceholders}`);
}
config.modResults.contents = gradleContent;
}
return config;
});
};
// Accept configuration options with a "scheme" property
const withAppRedirectScheme = (config, options = {}) => {
const { scheme } = options;
if (!scheme) {
throw new Error("AppRedirectScheme plugin requires a valid 'scheme' option");
}
return addRedirectSchemeToGradle(config, scheme);
};
module.exports = withAppRedirectScheme; which you can use as // app.config.js
const withAppRedirectScheme = require('./plugins/withAppRedirectScheme');
module.exports = {
name: "YourAppName",
slug: "your-app-name",
// other configuration options ...
plugins: [
[withAppRedirectScheme, { scheme: 'scheme' }]
],
}; in your app config to solve your issues. You can give it a try and test if it works for you. This way the placeholder will be filled for you during the prebuild phase by this mod. You can also take a look at these docs for more context https://docs.expo.dev/config-plugins/plugins-and-mods. I've seen in the repro you sent at the bottom of the issue that |
Thank you for looking at this @szdziedzic. The repro demo was taken from the original bug log mentioned, as it was quicker and more consistent than making a new one. Personally our project uses Expo Auth Session, and this problem started being encountered once in use. As per the bug log, this appears to be a problem with multiple Auth packages, and the eas build process when interpreting them, leading me to believe it is an issue with the eas build process itself for this gradle setting. It shouldn't really be necessary for me to have to use a custom config plugin for this to work, since expo are providing both the Auth package and the build service. I appreciate the effort as a workaround, but I already have a workaround in the form of a project patch. Ideally however it shouldn't require either, and any settings should be part of the Auth session configuration. |
It doesn't seem right to me to introduce logic to add some magic Android Manifest edit logic on the EAS Build side because it would be hacky and could potentially break some other setups + it can lead to weird side effects for all other projects that currently work well on EAS. The existing mechanism for such modifications is mods/plugins that are executed during prebuild and I believe that "magically" modifying the result config produced by it on EAS Build is dangerous and can lead to very hard-to-debug issues 🤔. I would say that this should be solved on the project level (or library) level by adding the config plugin to modify the result We can't really do much about other auth packages that we don't own, but yeah, if it is the issue with |
That seems fair enough. That would address my issue personally, and seems a less intrusive way to fix the issue. It could also be taken as an example by other package providers then as well. If the addition of a config-plugin to expo-auth-session would fix this issue by default for current users without the need for a workaround, then it sounds like the way to go. Thank you |
@dpuckett is there a chance that you have |
Apparently it is. It may have been added previously when attempting to solve other issues with expo-auth-session at the time. |
Yeah, I think this lib is the root cause of the issue. I believe that once you uninstall it, everything should start to work 🤔. |
Even without config plugins/workarounds |
Build/Submit details page URL
No response
Summary
This is a continuation from bug #2322 since no one will look at it.
This is causing multiple people using the Expo AuthSession package build issues, has been reopened multiple times and is being ignored.
Currently the only way to fix the problem is to manually change the android/app/build.gradle to include:
Then use patch-project to create a build time patch that is applied.
This is then however causing other side effects, and inconveniences.
Please refer to the original bug log AND FIX.
Managed or bare?
either
Environment
expo-env-info 1.2.1 environment info:
System:
OS: macOS 14.2
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.2.0 - /opt/homebrew/bin/node
Yarn: 1.22.22 - ~/.yarn/bin/yarn
npm: 10.2.3 - /opt/homebrew/bin/npm
Watchman: 2023.11.20.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.14.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
Android SDK:
API Levels: 28, 29, 30, 31, 32, 33, 34, 35
Build Tools: 30.0.3, 31.0.0, 33.0.0, 33.0.1, 34.0.0, 35.0.0, 35.0.0
System Images: android-30 | Google APIs ARM 64 v8a, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play ARM 64 v8a, android-31 | ARM 64 v8a, android-31 | Google APIs Intel x86 Atom_64, android-32 | Google APIs ARM 64 v8a, android-33 | Google APIs ARM 64 v8a, android-34 | Google APIs ARM 64 v8a, android-S | Google APIs ARM 64 v8a, android-VanillaIceCream | Google Play ARM 64 v8a
IDEs:
Android Studio: 2023.3 AI-233.14808.21.2331.11709847
Xcode: 15.3/15E204a - /usr/bin/xcodebuild
npmPackages:
expo: ^52.0.11 => 52.0.14
react: 18.3.1 => 18.3.1
react-dom: 18.3.1 => 18.3.1
react-native: 0.76.3 => 0.76.3
react-native-web: ~0.19.10 => 0.19.13
npmGlobalPackages:
eas-cli: 10.0.3
Expo Workflow: bare
Error output
No response
Reproducible demo or steps to reproduce from a blank project
https://snack.expo.dev/@hibobo/github.com-h1b0b0-trello-mobile-app
The text was updated successfully, but these errors were encountered: