diff --git a/Example/android/app/build.gradle b/Example/android/app/build.gradle.kts similarity index 63% rename from Example/android/app/build.gradle rename to Example/android/app/build.gradle.kts index 931486c89f..6dbad911fd 100644 --- a/Example/android/app/build.gradle +++ b/Example/android/app/build.gradle.kts @@ -1,6 +1,10 @@ -apply plugin: "com.android.application" -apply plugin: "org.jetbrains.kotlin.android" -apply plugin: "com.facebook.react" +import groovy.lang.Closure + +plugins { + id ("com.android.application") + id ("org.jetbrains.kotlin.android") + id ("com.facebook.react") +} /** * This is the configuration block to customize your React Native Android app. @@ -54,7 +58,7 @@ react { /** * Set this to true to Run Proguard on Release builds to minify the Java bytecode */ -def enableProguardInReleaseBuilds = false +val enableProguardInReleaseBuilds = false /** * The preferred build flavor of JavaScriptCore (JSC) @@ -67,71 +71,71 @@ def enableProguardInReleaseBuilds = false * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ -def jscFlavor = 'org.webkit:android-jsc:+' +val jscFlavor = "org.webkit:android-jsc:+" android { - ndkVersion rootProject.ext.ndkVersion - - buildToolsVersion rootProject.ext.buildToolsVersion - compileSdk rootProject.ext.compileSdkVersion - - namespace "com.swmansion.rnscreens.example" + ndkVersion = rootProject.extra["ndkVersion"] as String + compileSdk = rootProject.extra["compileSdkVersion"] as Int + namespace = "com.swmansion.rnscreens.example" defaultConfig { - applicationId "com.swmansion.rnscreens.example" - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0" - testBuildType System.getProperty('testBuildType', 'release') - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' + applicationId = "com.swmansion.rnscreens.example" + minSdkVersion(rootProject.extra["minSdkVersion"] as Int) + targetSdkVersion(rootProject.extra["targetSdkVersion"] as Int) + versionCode = 1 + versionName = "1.0" + testBuildType = System.getProperty("testBuildType", "release") + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } signingConfigs { - debug { - storeFile file('debug.keystore') - storePassword 'android' - keyAlias 'androiddebugkey' - keyPassword 'android' + getByName("debug") { + storeFile = file("debug.keystore") + storePassword = "android" + keyAlias = "androiddebugkey" + keyPassword = "android" } - release { - storeFile file("rns-example-keystore.jks") - storePassword "12345678" - keyAlias "react-native-screens-example" - keyPassword "12345678" + create("release") { + storeFile = file("rns-example-keystore.jks") + storePassword = "12345678" + keyAlias = "react-native-screens-example" + keyPassword = "12345678" } } buildTypes { - debug { - signingConfig signingConfigs.debug + getByName("debug") { + signingConfig = signingConfigs.getByName("debug") } - release { + getByName("release") { // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. - minifyEnabled enableProguardInReleaseBuilds - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + isMinifyEnabled = enableProguardInReleaseBuilds + proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") - signingConfig signingConfigs.release + signingConfig = signingConfigs.getByName("release") // Detox-specific additions to pro-guard - proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro" + proguardFile("${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro") } } } +val hermesEnabled: String by project dependencies { - androidTestImplementation('com.wix:detox:+') { + androidTestImplementation("com.wix:detox:+") { // Both rn-screens and detox are using this class // https://github.com/wix/Detox/issues/2848 - exclude group: 'com.google.android.material' + exclude(group = "com.google.android.material") } - implementation "androidx.appcompat:appcompat:1.6.1" - + implementation("androidx.appcompat:appcompat:1.6.1") + // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") if (hermesEnabled.toBoolean()) { implementation("com.facebook.react:hermes-android") } else { - implementation jscFlavor + implementation(jscFlavor) } } -apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) +apply (from = "../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") +val applyNativeModules: Closure = extra.get("applyNativeModulesAppBuildGradle") as Closure +applyNativeModules(project) diff --git a/Example/android/app/proguard-rules.pro b/Example/android/app/proguard-rules.pro index a92fa177ee..7f4adb11a7 100644 --- a/Example/android/app/proguard-rules.pro +++ b/Example/android/app/proguard-rules.pro @@ -2,7 +2,7 @@ # By default, the flags in this file are appended to flags specified # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. +# directive in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/Example/android/build.gradle b/Example/android/build.gradle.kts similarity index 63% rename from Example/android/build.gradle rename to Example/android/build.gradle.kts index 5406af3043..22109fac85 100644 --- a/Example/android/build.gradle +++ b/Example/android/build.gradle.kts @@ -1,12 +1,10 @@ buildscript { - ext { - buildToolsVersion = "34.0.0" - minSdkVersion = 23 - compileSdkVersion = 34 - targetSdkVersion = 34 - ndkVersion = "26.1.10909125" - kotlinVersion = "1.9.22" - } + val buildToolsVersion: String by extra("34.0.0") + val compileSdkVersion: Int by extra(34) + val minSdkVersion: Int by extra(23) + val targetSdkVersion: Int by extra(34) + val ndkVersion: String by extra("26.1.10909125") + val kotlinVersion: String by extra("1.9.22") repositories { google() mavenCentral() @@ -26,9 +24,9 @@ buildscript { allprojects { repositories { maven { - url("$rootDir/../node_modules/detox/Detox-android") + url = uri("$rootDir/../node_modules/detox/Detox-android") } } } -apply plugin: "com.facebook.react.rootproject" +apply (plugin= "com.facebook.react.rootproject") diff --git a/Example/android/settings.gradle b/Example/android/settings.gradle deleted file mode 100644 index d3cab467eb..0000000000 --- a/Example/android/settings.gradle +++ /dev/null @@ -1,4 +0,0 @@ -rootProject.name = 'ScreensExample' -apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) -include ':app' -includeBuild('../node_modules/@react-native/gradle-plugin') diff --git a/Example/android/settings.gradle.kts b/Example/android/settings.gradle.kts new file mode 100644 index 0000000000..daa9eeaf81 --- /dev/null +++ b/Example/android/settings.gradle.kts @@ -0,0 +1,8 @@ +import groovy.lang.Closure + +rootProject.name = "ScreensExample" +apply(from = "../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") +val applyNativeModules: Closure = extra.get("applyNativeModulesSettingsGradle") as Closure +applyNativeModules(settings) +include(":app") +includeBuild("../node_modules/@react-native/gradle-plugin") diff --git a/FabricTestExample/android/app/build.gradle b/FabricExample/android/app/build.gradle.kts similarity index 69% rename from FabricTestExample/android/app/build.gradle rename to FabricExample/android/app/build.gradle.kts index 881c02c816..a5659d89a3 100644 --- a/FabricTestExample/android/app/build.gradle +++ b/FabricExample/android/app/build.gradle.kts @@ -1,6 +1,10 @@ -apply plugin: "com.android.application" -apply plugin: "org.jetbrains.kotlin.android" -apply plugin: "com.facebook.react" +import groovy.lang.Closure + +plugins { + id ("com.android.application") + id ("com.facebook.react") + id ("org.jetbrains.kotlin.android") +} /** * This is the configuration block to customize your React Native Android app. @@ -54,7 +58,7 @@ react { /** * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */ -def enableProguardInReleaseBuilds = false +val enableProguardInReleaseBuilds = false /** * The preferred build flavor of JavaScriptCore (JSC) @@ -67,42 +71,43 @@ def enableProguardInReleaseBuilds = false * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ -def jscFlavor = 'org.webkit:android-jsc:+' +val jscFlavor = "org.webkit:android-jsc:+" android { - ndkVersion rootProject.ext.ndkVersion - buildToolsVersion rootProject.ext.buildToolsVersion - compileSdk rootProject.ext.compileSdkVersion + ndkVersion = rootProject.extra["ndkVersion"] as String + buildToolsVersion = rootProject.extra["buildToolsVersion"] as String + compileSdk = rootProject.extra["compileSdkVersion"] as Int - namespace "com.fabrictestexample" + namespace = "com.fabricexample" defaultConfig { - applicationId "com.fabrictestexample" - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0" + applicationId = "com.fabricexample" + minSdkVersion(rootProject.extra["minSdkVersion"] as Int) + targetSdkVersion(rootProject.extra["targetSdkVersion"] as Int) + versionCode = 1 + versionName = "1.0" } signingConfigs { - debug { - storeFile file('debug.keystore') - storePassword 'android' - keyAlias 'androiddebugkey' - keyPassword 'android' + getByName("debug") { + storeFile = file("debug.keystore") + storePassword = "android" + keyAlias = "androiddebugkey" + keyPassword = "android" } } buildTypes { - debug { - signingConfig signingConfigs.debug + getByName("debug") { + signingConfig = signingConfigs.getByName("debug") } - release { + getByName("release") { // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. - signingConfig signingConfigs.debug - minifyEnabled enableProguardInReleaseBuilds - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + signingConfig = signingConfigs.getByName("debug") + isMinifyEnabled = enableProguardInReleaseBuilds + proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") } } } +val hermesEnabled: String by project dependencies { // The version of react-native is set by the React Native Gradle Plugin @@ -111,8 +116,10 @@ dependencies { if (hermesEnabled.toBoolean()) { implementation("com.facebook.react:hermes-android") } else { - implementation jscFlavor + implementation(jscFlavor) } } -apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) +apply (from = "../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") +val applyNativeModules: Closure = extra.get("applyNativeModulesAppBuildGradle") as Closure +applyNativeModules(project) diff --git a/FabricExample/android/app/proguard-rules.pro b/FabricExample/android/app/proguard-rules.pro index 11b025724a..630c861681 100644 --- a/FabricExample/android/app/proguard-rules.pro +++ b/FabricExample/android/app/proguard-rules.pro @@ -2,7 +2,7 @@ # By default, the flags in this file are appended to flags specified # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. +# directive in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/FabricExample/android/build.gradle b/FabricExample/android/build.gradle deleted file mode 100644 index f536a79201..0000000000 --- a/FabricExample/android/build.gradle +++ /dev/null @@ -1,21 +0,0 @@ -buildscript { - ext { - buildToolsVersion = "34.0.0" - minSdkVersion = 23 - compileSdkVersion = 34 - targetSdkVersion = 34 - ndkVersion = "26.1.10909125" - kotlinVersion = "1.9.22" - } - repositories { - google() - mavenCentral() - } - dependencies { - classpath("com.android.tools.build:gradle") - classpath("com.facebook.react:react-native-gradle-plugin") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") - } -} - -apply plugin: "com.facebook.react.rootproject" diff --git a/FabricExample/android/build.gradle.kts b/FabricExample/android/build.gradle.kts new file mode 100644 index 0000000000..b13dc16d67 --- /dev/null +++ b/FabricExample/android/build.gradle.kts @@ -0,0 +1,21 @@ +buildscript { + extra.apply { + set("buildToolsVersion", "34.0.0") + set("minSdkVersion", 23) + set("compileSdkVersion", 34) + set("targetSdkVersion", 34) + set("ndkVersion", "26.1.10909125") + set("kotlinVersion", "1.9.22") + } + repositories { + google() + mavenCentral() + } + dependencies { + classpath("com.android.tools.build:gradle") + classpath("com.facebook.react:react-native-gradle-plugin") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") + } +} + +apply(plugin = "com.facebook.react.rootproject") diff --git a/FabricExample/android/settings.gradle b/FabricExample/android/settings.gradle deleted file mode 100644 index e5ed5d29b3..0000000000 --- a/FabricExample/android/settings.gradle +++ /dev/null @@ -1,4 +0,0 @@ -rootProject.name = 'FabricExample' -apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) -include ':app' -includeBuild('../node_modules/@react-native/gradle-plugin') diff --git a/FabricExample/android/settings.gradle.kts b/FabricExample/android/settings.gradle.kts new file mode 100644 index 0000000000..31d1ca148e --- /dev/null +++ b/FabricExample/android/settings.gradle.kts @@ -0,0 +1,8 @@ +import groovy.lang.Closure + +rootProject.name = "FabricExample" +apply(from = "../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") +val applyNativeModules: Closure = extra.get("applyNativeModulesSettingsGradle") as Closure +applyNativeModules(settings) +include(":app") +includeBuild("../node_modules/@react-native/gradle-plugin") \ No newline at end of file diff --git a/FabricExample/android/app/build.gradle b/FabricTestExample/android/app/build.gradle.kts similarity index 69% rename from FabricExample/android/app/build.gradle rename to FabricTestExample/android/app/build.gradle.kts index d21d88b502..a8a8e81960 100644 --- a/FabricExample/android/app/build.gradle +++ b/FabricTestExample/android/app/build.gradle.kts @@ -1,6 +1,10 @@ -apply plugin: "com.android.application" -apply plugin: "org.jetbrains.kotlin.android" -apply plugin: "com.facebook.react" +import groovy.lang.Closure + +plugins { + id ("com.android.application") + id ("org.jetbrains.kotlin.android") + id ("com.facebook.react") +} /** * This is the configuration block to customize your React Native Android app. @@ -54,7 +58,7 @@ react { /** * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */ -def enableProguardInReleaseBuilds = false +val enableProguardInReleaseBuilds = false /** * The preferred build flavor of JavaScriptCore (JSC) @@ -67,42 +71,43 @@ def enableProguardInReleaseBuilds = false * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ -def jscFlavor = 'org.webkit:android-jsc:+' +val jscFlavor = "org.webkit:android-jsc:+" android { - ndkVersion rootProject.ext.ndkVersion - buildToolsVersion rootProject.ext.buildToolsVersion - compileSdk rootProject.ext.compileSdkVersion + ndkVersion = rootProject.extra["ndkVersion"] as String + compileSdk = rootProject.extra["compileSdkVersion"] as Int + buildToolsVersion = rootProject.extra["buildToolsVersion"] as String - namespace "com.fabricexample" + namespace = "com.fabrictestexample" defaultConfig { - applicationId "com.fabricexample" - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0" + applicationId = "com.fabrictestexample" + minSdkVersion(rootProject.extra["minSdkVersion"] as Int) + targetSdkVersion(rootProject.extra["targetSdkVersion"] as Int) + versionCode = 1 + versionName = "1.0" } signingConfigs { - debug { - storeFile file('debug.keystore') - storePassword 'android' - keyAlias 'androiddebugkey' - keyPassword 'android' + getByName("debug") { + storeFile = file("debug.keystore") + storePassword = "android" + keyAlias = "androiddebugkey" + keyPassword = "android" } } buildTypes { - debug { - signingConfig signingConfigs.debug + getByName("debug") { + signingConfig = signingConfigs.getByName("debug") } - release { + getByName("release") { // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. - signingConfig signingConfigs.debug - minifyEnabled enableProguardInReleaseBuilds - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + signingConfig = signingConfigs.getByName("debug") + isMinifyEnabled = enableProguardInReleaseBuilds + proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") } } } +val hermesEnabled: String by project dependencies { // The version of react-native is set by the React Native Gradle Plugin @@ -111,8 +116,10 @@ dependencies { if (hermesEnabled.toBoolean()) { implementation("com.facebook.react:hermes-android") } else { - implementation jscFlavor + implementation(jscFlavor) } } -apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) +apply (from = "../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") +val applyNativeModules: Closure = extra.get("applyNativeModulesAppBuildGradle") as Closure +applyNativeModules(project) diff --git a/FabricTestExample/android/app/proguard-rules.pro b/FabricTestExample/android/app/proguard-rules.pro index 11b025724a..630c861681 100644 --- a/FabricTestExample/android/app/proguard-rules.pro +++ b/FabricTestExample/android/app/proguard-rules.pro @@ -2,7 +2,7 @@ # By default, the flags in this file are appended to flags specified # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. +# directive in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/FabricTestExample/android/build.gradle b/FabricTestExample/android/build.gradle deleted file mode 100644 index f536a79201..0000000000 --- a/FabricTestExample/android/build.gradle +++ /dev/null @@ -1,21 +0,0 @@ -buildscript { - ext { - buildToolsVersion = "34.0.0" - minSdkVersion = 23 - compileSdkVersion = 34 - targetSdkVersion = 34 - ndkVersion = "26.1.10909125" - kotlinVersion = "1.9.22" - } - repositories { - google() - mavenCentral() - } - dependencies { - classpath("com.android.tools.build:gradle") - classpath("com.facebook.react:react-native-gradle-plugin") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") - } -} - -apply plugin: "com.facebook.react.rootproject" diff --git a/FabricTestExample/android/build.gradle.kts b/FabricTestExample/android/build.gradle.kts new file mode 100644 index 0000000000..b0d7012234 --- /dev/null +++ b/FabricTestExample/android/build.gradle.kts @@ -0,0 +1,19 @@ +buildscript { + val buildToolsVersion: String by extra("34.0.0") + val compileSdkVersion: Int by extra(34) + val minSdkVersion: Int by extra(23) + val targetSdkVersion: Int by extra(34) + val ndkVersion: String by extra("26.1.10909125") + val kotlinVersion: String by extra("1.9.22") + repositories { + google() + mavenCentral() + } + dependencies { + classpath("com.android.tools.build:gradle") + classpath("com.facebook.react:react-native-gradle-plugin") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") + } +} + +apply(plugin = "com.facebook.react.rootproject") diff --git a/FabricTestExample/android/settings.gradle b/FabricTestExample/android/settings.gradle deleted file mode 100644 index 60ac0b2533..0000000000 --- a/FabricTestExample/android/settings.gradle +++ /dev/null @@ -1,4 +0,0 @@ -rootProject.name = 'FabricTestExample' -apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) -include ':app' -includeBuild('../node_modules/@react-native/gradle-plugin') diff --git a/FabricTestExample/android/settings.gradle.kts b/FabricTestExample/android/settings.gradle.kts new file mode 100644 index 0000000000..af0e24bad7 --- /dev/null +++ b/FabricTestExample/android/settings.gradle.kts @@ -0,0 +1,8 @@ +import groovy.lang.Closure + +rootProject.name = "FabricTestExample" +apply(from = "../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") +val applyNativeModules: Closure = extra.get("applyNativeModulesSettingsGradle") as Closure +applyNativeModules(settings) +include(":app") +includeBuild("../node_modules/@react-native/gradle-plugin") diff --git a/TestsExample/android/app/build.gradle b/TestsExample/android/app/build.gradle.kts similarity index 69% rename from TestsExample/android/app/build.gradle rename to TestsExample/android/app/build.gradle.kts index 38f5f5972c..6f1091319f 100644 --- a/TestsExample/android/app/build.gradle +++ b/TestsExample/android/app/build.gradle.kts @@ -1,6 +1,10 @@ -apply plugin: "com.android.application" -apply plugin: "org.jetbrains.kotlin.android" -apply plugin: "com.facebook.react" +import groovy.lang.Closure + +plugins { + id ("com.android.application") + id ("org.jetbrains.kotlin.android") + id ("com.facebook.react") +} /** * This is the configuration block to customize your React Native Android app. @@ -54,7 +58,7 @@ react { /** * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */ -def enableProguardInReleaseBuilds = false +val enableProguardInReleaseBuilds = false /** * The preferred build flavor of JavaScriptCore (JSC) @@ -67,43 +71,43 @@ def enableProguardInReleaseBuilds = false * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ -def jscFlavor = 'org.webkit:android-jsc:+' +val jscFlavor = "org.webkit:android-jsc:+" android { - ndkVersion rootProject.ext.ndkVersion - - buildToolsVersion rootProject.ext.buildToolsVersion - compileSdk rootProject.ext.compileSdkVersion + ndkVersion = rootProject.extra["ndkVersion"] as String + compileSdk = rootProject.extra["compileSdkVersion"] as Int + buildToolsVersion = rootProject.extra["buildToolsVersion"] as String - namespace "com.testsexample" + namespace = "com.testsexample" defaultConfig { - applicationId "com.testsexample" - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0" + applicationId = "com.testsexample" + minSdkVersion(rootProject.extra["minSdkVersion"] as Int) + targetSdkVersion(rootProject.extra["targetSdkVersion"] as Int) + versionCode = 1 + versionName = "1.0" } signingConfigs { - debug { - storeFile file('debug.keystore') - storePassword 'android' - keyAlias 'androiddebugkey' - keyPassword 'android' + getByName("debug") { + storeFile = file("debug.keystore") + storePassword = "android" + keyAlias = "androiddebugkey" + keyPassword = "android" } } buildTypes { - debug { - signingConfig signingConfigs.debug + getByName("debug") { + signingConfig = signingConfigs.getByName("debug") } - release { + getByName("release") { // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. - signingConfig signingConfigs.debug - minifyEnabled enableProguardInReleaseBuilds - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + signingConfig = signingConfigs.getByName("debug") + isMinifyEnabled = enableProguardInReleaseBuilds + proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") } } } +val hermesEnabled: String by project dependencies { // The version of react-native is set by the React Native Gradle Plugin @@ -112,8 +116,10 @@ dependencies { if (hermesEnabled.toBoolean()) { implementation("com.facebook.react:hermes-android") } else { - implementation jscFlavor + implementation(jscFlavor) } } -apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) +apply (from = "../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") +val applyNativeModules: Closure = extra.get("applyNativeModulesAppBuildGradle") as Closure +applyNativeModules(project) diff --git a/TestsExample/android/build.gradle b/TestsExample/android/build.gradle deleted file mode 100644 index aa9905716d..0000000000 --- a/TestsExample/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - ext { - buildToolsVersion = "34.0.0" - minSdkVersion = 23 - compileSdkVersion = 34 - targetSdkVersion = 34 - - ndkVersion = "26.1.10909125" - kotlinVersion = "1.9.22" - } - repositories { - google() - mavenCentral() - } - dependencies { - classpath("com.android.tools.build:gradle") - classpath("com.facebook.react:react-native-gradle-plugin") - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" - } -} - -apply plugin: "com.facebook.react.rootproject" diff --git a/TestsExample/android/build.gradle.kts b/TestsExample/android/build.gradle.kts new file mode 100644 index 0000000000..02fb38287a --- /dev/null +++ b/TestsExample/android/build.gradle.kts @@ -0,0 +1,21 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + val buildToolsVersion: String by extra("34.0.0") + val compileSdkVersion: Int by extra(34) + val minSdkVersion: Int by extra(23) + val targetSdkVersion: Int by extra(34) + val ndkVersion: String by extra("26.1.10909125") + val kotlinVersion: String by extra("1.9.22") + repositories { + google() + mavenCentral() + } + dependencies { + classpath("com.android.tools.build:gradle") + classpath("com.facebook.react:react-native-gradle-plugin") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") + } +} + +apply(plugin = "com.facebook.react.rootproject") diff --git a/TestsExample/android/settings.gradle b/TestsExample/android/settings.gradle deleted file mode 100644 index 1c3e68eca2..0000000000 --- a/TestsExample/android/settings.gradle +++ /dev/null @@ -1,4 +0,0 @@ -rootProject.name = 'TestsExample' -apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) -include ':app' -includeBuild('../node_modules/@react-native/gradle-plugin') diff --git a/TestsExample/android/settings.gradle.kts b/TestsExample/android/settings.gradle.kts new file mode 100644 index 0000000000..47b370593e --- /dev/null +++ b/TestsExample/android/settings.gradle.kts @@ -0,0 +1,8 @@ +import groovy.lang.Closure + +rootProject.name = "TestsExample" +apply(from = "../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") +val applyNativeModules: Closure = extra.get("applyNativeModulesSettingsGradle") as Closure +applyNativeModules(settings) +include(":app") +includeBuild("../node_modules/@react-native/gradle-plugin") diff --git a/android/build.gradle b/android/build.gradle index fbc634305c..cd7a2b6c73 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,4 @@ import com.android.Version -import groovy.json.JsonSlurper buildscript { ext { diff --git a/android/settings.gradle b/android/settings.gradle index c8e23f4979..40643f62f1 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1 +1,2 @@ -include 'lib' \ No newline at end of file +include 'lib' + diff --git a/android/spotless.gradle b/android/spotless.gradle index be623081b8..4ede2ce1a3 100644 --- a/android/spotless.gradle +++ b/android/spotless.gradle @@ -1,5 +1,5 @@ // formatter & linter configuration for kotlin -apply plugin: 'com.diffplug.spotless' +apply plugin: "com.diffplug.spotless" spotless { kotlin {