Skip to content

Commit 8f347f2

Browse files
authored
fix(android): minSdkVersion was bumped to 24 in latest nightly (#2182)
1 parent 763e858 commit 8f347f2

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

android/app/src/main/java/com/microsoft/reacttestapp/react/TestAppReactNativeHost.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import com.facebook.react.bridge.JavaScriptExecutorFactory
1515
import com.facebook.react.bridge.ReactContext
1616
import com.facebook.react.devsupport.interfaces.DevSupportManager
1717
import com.facebook.react.packagerconnection.PackagerConnectionSettings
18-
import com.facebook.soloader.SoLoader
1918
import com.microsoft.reacttestapp.BuildConfig
2019
import com.microsoft.reacttestapp.MainActivity
2120
import com.microsoft.reacttestapp.R
@@ -171,10 +170,7 @@ class TestAppReactNativeHost(
171170
return reactInstanceManager
172171
}
173172

174-
override fun getJavaScriptExecutorFactory(): JavaScriptExecutorFactory {
175-
SoLoader.init(application, false)
176-
return HermesExecutorFactory()
177-
}
173+
override fun getJavaScriptExecutorFactory(): JavaScriptExecutorFactory = HermesExecutorFactory()
178174

179175
override fun getJSMainModuleName() = "index"
180176

android/app/src/reactapplication-0.73/java/com/microsoft/reacttestapp/TestApp.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class TestApp :
4141
override fun onCreate() {
4242
super.onCreate()
4343

44+
@Suppress("DEPRECATION")
4445
SoLoader.init(this, false)
4546

4647
reactNativeBundleNameProvider = ReactBundleNameProvider(this, manifest.bundleRoot)

android/app/src/reactapplication-pre-0.73/java/com/microsoft/reacttestapp/TestApp.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class TestApp :
3333
override fun onCreate() {
3434
super.onCreate()
3535

36+
@Suppress("DEPRECATION")
3637
SoLoader.init(this, false)
3738

3839
reactNativeBundleNameProvider = ReactBundleNameProvider(this, manifest.bundleRoot)

android/dependencies.gradle

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
ext {
22
apply(from: "${buildscript.sourceFile.getParent()}/test-app-util.gradle")
33

4-
compileSdkVersion = rootProject.findProperty("react.compileSdkVersion") ?: 34
5-
minSdkVersion = rootProject.findProperty("react.minSdkVersion") ?: 23
6-
targetSdkVersion = rootProject.findProperty("react.targetSdkVersion") ?: 33
7-
84
/**
95
* Returns the recommended Gradle plugin version for the specified React Native
106
* version.
@@ -21,7 +17,22 @@ ext {
2117
}
2218
}
2319

20+
// TODO: Bump `minSdkVersion` to 24 in 4.0
21+
def getDefaultMinSdkVersion = { reactNativeVersion ->
22+
if (reactNativeVersion >= v(0, 76, 0)) {
23+
return 24
24+
} else {
25+
return 23
26+
}
27+
}
28+
2429
reactNativeVersion = getPackageVersionNumber("react-native", rootDir)
30+
31+
compileSdkVersion = rootProject.findProperty("react.compileSdkVersion") ?: 34
32+
minSdkVersion = rootProject.findProperty("react.minSdkVersion")
33+
?: getDefaultMinSdkVersion(reactNativeVersion)
34+
targetSdkVersion = rootProject.findProperty("react.targetSdkVersion") ?: 33
35+
2536
autodetectReactNativeVersion = reactNativeVersion == 0 || reactNativeVersion >= v(0, 71, 0)
2637
enableNewArchitecture = isNewArchitectureEnabled(project)
2738
enableBridgeless = isBridgelessEnabled(project, enableNewArchitecture)

android/test-app-util.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ ext.getApplicationId = {
151151

152152
ext.getArchitectures = { project ->
153153
def archs = project.findProperty("react.nativeArchitectures")
154-
?: project.findProperty("reactNativeArchitectures")
154+
?: project.findProperty("reactNativeArchitectures")
155155
return archs != null
156156
? archs.split(",")
157157
: ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
@@ -284,7 +284,7 @@ ext.getVersionName = {
284284
ext.isBridgelessEnabled = { project, isNewArchEnabled ->
285285
if (isNewArchEnabled) {
286286
def bridgelessEnabled = project.findProperty("react.bridgelessEnabled")
287-
?: project.findProperty("bridgelessEnabled")
287+
?: project.findProperty("bridgelessEnabled")
288288
if (bridgelessEnabled != "false") {
289289
def version = getPackageVersionNumber("react-native", project.rootDir)
290290
def isSupported = version == 0 || version >= v(0, 73, 0)
@@ -314,7 +314,7 @@ ext.isFabricEnabled = { project ->
314314

315315
ext.isNewArchitectureEnabled = { project ->
316316
def newArchEnabled = project.findProperty("react.newArchEnabled")
317-
?: project.findProperty("newArchEnabled")
317+
?: project.findProperty("newArchEnabled")
318318
if (newArchEnabled == "true") {
319319
def version = getPackageVersionNumber("react-native", project.rootDir)
320320
def isSupported = version == 0 || version >= v(0, 71, 0)

0 commit comments

Comments
 (0)