Repository navigation
Conversation
`generateReactNativeEntryPoint` writes a class that reads `<package>.BuildConfig`, and takes the package from `project.android.packageName` in the autolinking config. The config describes one application. In a build with two applications that apply the React plugin, the second application's entry point names the first application's `BuildConfig`, which is not on its classpath, so it does not compile. AGP generates `BuildConfig` in the application's `namespace` (https://developer.android.com/build/configure-app-module#set-namespace), so pass that to the task and use it when it is set. The config's package name remains the fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Visual regressionNo visual differences at ios: no capture |
Contributor
Author
|
Closing: this only matters for a build that holds two React Native apps, which isn't a setup React Native supports. The change stays in Expo's fork, with the app that needs it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
generateReactNativeEntryPointwritesReactNativeApplicationEntryPoint, which reads<package>.BuildConfig.IS_NEW_ARCHITECTURE_ENABLEDandIS_EDGE_TO_EDGE_ENABLED. The task takes the package fromproject.android.packageNamein the autolinking config, which describes one application. In a build with two applications that apply the React plugin, the second application's entry point names the first application'sBuildConfig, which is not on its classpath, so the second application does not compile.AGP generates
BuildConfigin the application'snamespace. This change passes the namespace to the task, which uses it when it is set. The config's package name remains the fallback, so a build that does not set the property behaves as before.GeneratePackageListTaskalso takes the package name from the config, to expandBuildConfigandRin a library'spackageInstance. This change does not touch it.Changelog:
[ANDROID] [FIXED] - Generate the React Native entry point against the app's own namespace, so a build can hold two apps
Test Plan:
GenerateEntryPointTaskTestgains two tests oftaskAction: withapplicationNamespaceset, the generated file readsBuildConfigfrom that namespace and does not mention the config's package; without it, the file readsBuildConfigfrom the config's package.applicationNamespace:taskAction_withApplicationNamespace_readsBuildConfigFromItfails.Also run: ktfmt
--dry-run --set-exit-if-changedon the three changed Kotlin files (clean),git diff --check(clean).The whole plugin suite (
./gradlew -p packages/gradle-plugin test) on this branch: 249 tests, 248 pass. The one failure,PreparePrefabHeadersTaskTest.preparePrefabHeadersTask_declaresTheHeadersItCopiesAsInputs, fails the same way onmainon macOS, where the test's temporary directory resolves through/private/var(#60375 fixes it).Not run: no test covers the line in
ReactPluginthat reads the namespace fromApplicationExtension, and no Android build with one or two applications was run with this branch.🤖 Generated with Claude Code