Skip to content
Closed
5 changes: 5 additions & 0 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ task androidSourcesJar(type: Jar) {
}

android {
buildToolsVersion = "31.0.0"
compileSdkVersion 31

// Used to override the NDK path & version on internal CI
Expand Down Expand Up @@ -418,6 +419,10 @@ afterEvaluate {

// Needed as some of the native sources needs to be downloaded
// before configureNdkBuildDebug could be executed.
reactNativeArchitectures().each { architecture ->
tasks.named("configureNdkBuildDebug[${architecture}]") { dependsOn(preBuild) }
tasks.named("configureNdkBuildRelease[${architecture}]") { dependsOn(preBuild) }
}
configureNdkBuildDebug.dependsOn(preBuild)
configureNdkBuildRelease.dependsOn(preBuild)

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
}
dependencies {
val kotlin_version: String by project
classpath("com.android.tools.build:gradle:7.0.4")
classpath("com.android.tools.build:gradle:7.1.1")
classpath("de.undercouch:gradle-download-task:5.0.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
// NOTE: Do not place your application dependencies here; they belong
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ internal fun Project.configureReactTasks(variant: BaseVariant, config: ReactExte
it.into(jsBundleDirConfigValue.get())
} else {
it.into(mergeAssetsTask.map { mergeFoldersTask -> mergeFoldersTask.outputDir.get() })
// Workaround for Android Gradle Plugin 7.1 asset directory
it.into("$buildDir/intermediates/assets/${variant.name}/merge${targetName}Assets")
}

it.dependsOn(mergeAssetsTask)
Expand Down
11 changes: 11 additions & 0 deletions packages/rn-tester/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def reactNativeArchitectures() {
}

android {
buildToolsVersion = "31.0.0"
compileSdkVersion 31

// Used to override the NDK path & version on internal CI
Expand Down Expand Up @@ -298,6 +299,16 @@ if (enableCodegen) {
}

afterEvaluate {
reactNativeArchitectures().each { architecture ->
tasks.named("configureNdkBuildDebug[${architecture}]") {
dependsOn("preHermesDebugBuild")
dependsOn("preJscDebugBuild")
}
tasks.named("configureNdkBuildRelease[${architecture}]") {
dependsOn("preHermesReleaseBuild")
dependsOn("preJscReleaseBuild")
}
}
configureNdkBuildRelease.dependsOn(packageReactReleaseNdkLibs)
preHermesReleaseBuild.dependsOn(packageReactReleaseNdkLibs)
preJscReleaseBuild.dependsOn(packageReactReleaseNdkLibs)
Expand Down
21 changes: 8 additions & 13 deletions react.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -318,29 +318,24 @@ afterEvaluate {
group = "react"
description = "copy bundled JS into ${targetName}."

from(jsBundleDir)
if (config."jsBundleDir${targetName}") {
from(jsBundleDir)
into(file(config."jsBundleDir${targetName}"))
} else {
into ("$buildDir/intermediates")
if (isAndroidLibrary) {
into ("library_assets/${variant.name}/out") {
from(jsBundleDir)
}
into ("library_assets/${variant.name}/out")
} else {
into ("assets/${targetPath}") {
from(jsBundleDir)
}
into ("assets/${targetPath}")

// Workaround for Android Gradle Plugin 3.2+ new asset directory
into ("merged_assets/${variant.name}/merge${targetName}Assets/out") {
from(jsBundleDir)
}
into ("merged_assets/${variant.name}/merge${targetName}Assets/out")

// Workaround for Android Gradle Plugin 3.4+ new asset directory
into ("merged_assets/${variant.name}/out") {
from(jsBundleDir)
}
into ("merged_assets/${variant.name}/out")

// Workaround for Android Gradle Plugin 7.1 asset directory
into("$buildDir/intermediates/assets/${variant.name}/merge${targetName}Assets")
}
}

Expand Down
2 changes: 1 addition & 1 deletion template/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.4")
classpath("com.android.tools.build:gradle:7.1.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")
// NOTE: Do not place your application dependencies here; they belong
Expand Down