Skip to content

Commit 83730cc

Browse files
msluszniakclaude
andcommitted
fix: fix Android Gradle paths for yarn workspace monorepo
node_modules are hoisted to the repo root, so update settings.gradle and app/build.gradle to point to ../../../node_modules/ instead of ../node_modules/. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c8988a5 commit 83730cc

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

apps/bare_rn/android/app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ apply plugin: "com.facebook.react"
99
react {
1010
/* Folders */
1111
// The root of your project, i.e. where "package.json" lives. Default is '../..'
12-
// root = file("../../")
12+
root = file("../../")
1313
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
14-
// reactNativeDir = file("../../node_modules/react-native")
14+
reactNativeDir = file("../../../../node_modules/react-native")
1515
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
16-
// codegenDir = file("../../node_modules/@react-native/codegen")
16+
codegenDir = file("../../../../node_modules/@react-native/codegen")
1717
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
18-
// cliFile = file("../../node_modules/react-native/cli.js")
18+
cliFile = file("../../../../node_modules/react-native/cli.js")
1919

2020
/* Variants */
2121
// The list of variants to that are debuggable. For those we're going to
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
1+
pluginManagement { includeBuild("../../../node_modules/@react-native/gradle-plugin") }
22
plugins { id("com.facebook.react.settings") }
3-
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
3+
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex ->
4+
// node_modules are hoisted to the repo root in this yarn workspace
5+
def cliFile = new File(settings.rootDir, "../../../node_modules/@react-native-community/cli/build/bin.js").absolutePath
6+
ex.autolinkLibrariesFromCommand(["node", cliFile, "config"], new File(settings.rootDir, "../"))
7+
}
48
rootProject.name = 'bare_rn'
59
include ':app'
6-
includeBuild('../node_modules/@react-native/gradle-plugin')
10+
includeBuild('../../../node_modules/@react-native/gradle-plugin')

0 commit comments

Comments
 (0)