Skip to content

Commit 117e548

Browse files
committed
android: Fix build to get react-native only from local Maven repo
This fixes a build failure which started happening today due to an operational mistake in React Native release management: facebook/react-native#35204 Happily Gradle gives us a way to more precisely pin down what we want it to do when finding dependencies, which makes the build robust to this and any similar issue. I've sent the same fix upstream for the template app: facebook/react-native#35208 See also where we spotted the issue in CI: zulip#5524 (comment) and discussion in chat: https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/build.20failure.3A.20libfbjni.2Eso.20duplicated/near/1459787
1 parent 77a645f commit 117e548

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

android/build.gradle

+14-10
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,26 @@ buildscript {
3636

3737
allprojects {
3838
repositories {
39-
maven {
40-
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
41-
url "$rootDir/../node_modules/react-native/android"
39+
exclusiveContent {
40+
// We get React Native's Android binaries exclusively through npm,
41+
// from a local Maven repo inside node_modules/react-native/.
42+
// (The use of exclusiveContent prevents looking elsewhere like Maven Central
43+
// and potentially getting a wrong version.)
44+
filter {
45+
includeGroup "com.facebook.react"
46+
}
47+
forRepository {
48+
maven {
49+
url "$rootDir/../node_modules/react-native/android"
50+
}
51+
}
4252
}
4353
maven {
4454
// Android JSC is installed from npm
4555
url("$rootDir/../node_modules/jsc-android/dist")
4656
}
4757

48-
mavenCentral {
49-
// We don't want to fetch react-native from Maven Central as there are
50-
// older versions over there.
51-
content {
52-
excludeGroup "com.facebook.react"
53-
}
54-
}
58+
mavenCentral()
5559
google()
5660

5761
// The retired "jcenter" repo.

0 commit comments

Comments
 (0)