Skip to content

Commit

Permalink
RN 0.63.2 -> 0.70.5: fix Read timed out when compiling on Android j…
Browse files Browse the repository at this point in the history
  • Loading branch information
flyskywhy committed May 25, 2023
1 parent 27ac0f5 commit 96fad3d
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 65 deletions.
92 changes: 27 additions & 65 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,69 +40,31 @@ buildscript {
}
}

allprojects {
repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/central' }
// maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }

maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
}
}

subprojects {
afterEvaluate {
// to fix `Read timed out` e.g.
// > Could not resolve all artifacts for configuration ':react-native-fs:classpath'.
// > Could not download bcprov-jdk15on-1.48.jar (org.bouncycastle:bcprov-jdk15on:1.48)
// > Could not get resource 'https://repo.maven.apache.org/maven2/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.jar'.
// > Read timed out
// > Could not download guava-17.0.jar (com.google.guava:guava:17.0)
// > Could not get resource 'https://repo.maven.apache.org/maven2/com/google/guava/guava/17.0/guava-17.0.jar'.
// > Read timed out
repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/central' }
// maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
// NOTE: use dependencyResolutionManagement in settings.gradle instead of below
// allprojects {
// repositories {
// maven { url 'https://maven.aliyun.com/repository/google' }
// maven { url 'https://maven.aliyun.com/repository/jcenter' }
// maven { url 'https://maven.aliyun.com/repository/central' }
// // maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
// maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }

maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}

mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
}
}
}
// maven {
// // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
// url("$rootDir/../node_modules/react-native/android")
// }
// maven {
// // Android JSC is installed from npm
// url("$rootDir/../node_modules/jsc-android/dist")
// }
// mavenCentral {
// // We don't want to fetch react-native from Maven Central as there are
// // older versions over there.
// content {
// excludeGroup "com.facebook.react"
// }
// }
// google()
// maven { url 'https://www.jitpack.io' }
// }
// }
42 changes: 42 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,45 @@ if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true")
include(":ReactAndroid:hermes-engine")
project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine')
}

// ref to https://docs.gradle.org/7.5.1/userguide/declaring_repositories.html#sub:centralized-repository-declaration
dependencyResolutionManagement {
// to fix `Read timed out` e.g.
// > Could not resolve com.facebook.react:react-native:0.70.+.
// > Failed to list versions for com.facebook.react:react-native.
// > Unable to load Maven meta-data from https://maven.google.com/com/facebook/react/react-native/maven-metadata.xml.
// > Could not GET 'https://maven.google.com/com/facebook/react/react-native/maven-metadata.xml'.
// > Read timed out
// > Could not download bcprov-jdk15on-1.48.jar (org.bouncycastle:bcprov-jdk15on:1.48)
// > Could not get resource 'https://repo.maven.apache.org/maven2/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.jar'.
// > Read timed out
// > Could not download guava-17.0.jar (com.google.guava:guava:17.0)
// > Could not get resource 'https://repo.maven.apache.org/maven2/com/google/guava/guava/17.0/guava-17.0.jar'.
// > Read timed out
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/central' }
// maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }

maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
}
}

0 comments on commit 96fad3d

Please sign in to comment.