Skip to content

Commit

Permalink
[RN0.66] 6/n: Various Android updates
Browse files Browse the repository at this point in the history
Summary:
Various changes that apply to Android config files for the React Native upgrade.

Note that there are three changes here from React Native 0.67:

- Fixing typo in code comment in `native/android/app/build.gradle`
- Fixing typo in code comment in `native/android/gradle.properties`
- `excludeGroup "com.facebook.react"` for `mavenCentral` in `native/android/build.gradle`

Also note that the changes to the NDK version here will necessitate that every developer installs the new NDK version here. Otherwise you will see this error when trying to run any Gradle build:

```
org.gradle.api.InvalidUserDataException: NDK not configured. Download it with SDK manager. Preferred NDK version is '21.4.7075529'.
```

Also note that I was unable to remove the `jcenter` dependency because of [this](TheWidlarzGroup/react-native-video#2454) `react-native-video` issue.

Test Plan: Built and ran the whole stack on iOS and Android across various architectures

Reviewers: palys-swm, atul

Reviewed By: palys-swm

Subscribers: benschac, Adrian, karol-bisztyga

Differential Revision: https://phabricator.ashoat.com/D2985
  • Loading branch information
Ashoat committed Jan 31, 2022
1 parent 6937ea8 commit 12be9c4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
19 changes: 12 additions & 7 deletions native/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,17 @@ def jscFlavor = 'org.webkit:android-jsc:+'
/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and mirrored here. If it is not set
* This should be set on project.ext.react and that value will be read here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false)

/**
* Architectures to build native code for in debug.
*/
def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")

def customDownloadsDir = System.getenv("REACT_NATIVE_DOWNLOADS_DIR")
def dependenciesPath = System.getenv("REACT_NATIVE_DEPENDENCIES")
def downloadsDir = customDownloadsDir ? new File(customDownloadsDir) : new File("$buildDir/downloads")
Expand Down Expand Up @@ -395,6 +400,11 @@ def getBuildTypeABIs() {
logger.info("Using all architectures to build: ${allAbis}")
return allAbis
}
if (nativeArchitectures) {
// TODO delete this log statement before diffing
logger.info("test, nativeArchitectures detected")
return nativeArchitectures.split(',')
}
// Get current 'adb devices' architectures
def commandOutput = new ByteArrayOutputStream()
exec {
Expand All @@ -421,11 +431,6 @@ android {

compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
applicationId 'app.comm.android'
minSdkVersion rootProject.ext.minSdkVersion
Expand Down Expand Up @@ -573,7 +578,7 @@ dependencies {
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
from configurations.implementation
into 'libs'
}

Expand Down
16 changes: 11 additions & 5 deletions native/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

buildscript {
ext {
buildToolsVersion = "29.0.3"
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "20.1.5948944"
ndkVersion = "21.4.7075529"
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.2")
classpath("com.android.tools.build:gradle:4.2.2")
classpath("de.undercouch:gradle-download-task:4.0.2")
classpath("com.google.gms:google-services:4.2.0")
classpath('org.ajoberstar:grgit:1.7.2')
Expand All @@ -38,9 +38,15 @@ allprojects {
// 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()
jcenter()
mavenCentral()
maven { url 'https://www.jitpack.io' }
}
}
4 changes: 2 additions & 2 deletions native/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# Default value: -Xmx1024m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
Expand All @@ -25,7 +25,7 @@ android.useAndroidX=true
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.98.0
FLIPPER_VERSION=0.99.0

FOLLY_VERSION=2020.01.13.00
GLOG_VERSION=0.4.0
Expand Down

0 comments on commit 12be9c4

Please sign in to comment.