Skip to content

Commit

Permalink
fix(android): minSdkVersion was bumped to 24 in latest nightly (#2182)
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Aug 19, 2024
1 parent 763e858 commit 8f347f2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.facebook.react.bridge.JavaScriptExecutorFactory
import com.facebook.react.bridge.ReactContext
import com.facebook.react.devsupport.interfaces.DevSupportManager
import com.facebook.react.packagerconnection.PackagerConnectionSettings
import com.facebook.soloader.SoLoader
import com.microsoft.reacttestapp.BuildConfig
import com.microsoft.reacttestapp.MainActivity
import com.microsoft.reacttestapp.R
Expand Down Expand Up @@ -171,10 +170,7 @@ class TestAppReactNativeHost(
return reactInstanceManager
}

override fun getJavaScriptExecutorFactory(): JavaScriptExecutorFactory {
SoLoader.init(application, false)
return HermesExecutorFactory()
}
override fun getJavaScriptExecutorFactory(): JavaScriptExecutorFactory = HermesExecutorFactory()

override fun getJSMainModuleName() = "index"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class TestApp :
override fun onCreate() {
super.onCreate()

@Suppress("DEPRECATION")
SoLoader.init(this, false)

reactNativeBundleNameProvider = ReactBundleNameProvider(this, manifest.bundleRoot)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class TestApp :
override fun onCreate() {
super.onCreate()

@Suppress("DEPRECATION")
SoLoader.init(this, false)

reactNativeBundleNameProvider = ReactBundleNameProvider(this, manifest.bundleRoot)
Expand Down
19 changes: 15 additions & 4 deletions android/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
ext {
apply(from: "${buildscript.sourceFile.getParent()}/test-app-util.gradle")

compileSdkVersion = rootProject.findProperty("react.compileSdkVersion") ?: 34
minSdkVersion = rootProject.findProperty("react.minSdkVersion") ?: 23
targetSdkVersion = rootProject.findProperty("react.targetSdkVersion") ?: 33

/**
* Returns the recommended Gradle plugin version for the specified React Native
* version.
Expand All @@ -21,7 +17,22 @@ ext {
}
}

// TODO: Bump `minSdkVersion` to 24 in 4.0
def getDefaultMinSdkVersion = { reactNativeVersion ->
if (reactNativeVersion >= v(0, 76, 0)) {
return 24
} else {
return 23
}
}

reactNativeVersion = getPackageVersionNumber("react-native", rootDir)

compileSdkVersion = rootProject.findProperty("react.compileSdkVersion") ?: 34
minSdkVersion = rootProject.findProperty("react.minSdkVersion")
?: getDefaultMinSdkVersion(reactNativeVersion)
targetSdkVersion = rootProject.findProperty("react.targetSdkVersion") ?: 33

autodetectReactNativeVersion = reactNativeVersion == 0 || reactNativeVersion >= v(0, 71, 0)
enableNewArchitecture = isNewArchitectureEnabled(project)
enableBridgeless = isBridgelessEnabled(project, enableNewArchitecture)
Expand Down
6 changes: 3 additions & 3 deletions android/test-app-util.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ ext.getApplicationId = {

ext.getArchitectures = { project ->
def archs = project.findProperty("react.nativeArchitectures")
?: project.findProperty("reactNativeArchitectures")
?: project.findProperty("reactNativeArchitectures")
return archs != null
? archs.split(",")
: ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
Expand Down Expand Up @@ -284,7 +284,7 @@ ext.getVersionName = {
ext.isBridgelessEnabled = { project, isNewArchEnabled ->
if (isNewArchEnabled) {
def bridgelessEnabled = project.findProperty("react.bridgelessEnabled")
?: project.findProperty("bridgelessEnabled")
?: project.findProperty("bridgelessEnabled")
if (bridgelessEnabled != "false") {
def version = getPackageVersionNumber("react-native", project.rootDir)
def isSupported = version == 0 || version >= v(0, 73, 0)
Expand Down Expand Up @@ -314,7 +314,7 @@ ext.isFabricEnabled = { project ->

ext.isNewArchitectureEnabled = { project ->
def newArchEnabled = project.findProperty("react.newArchEnabled")
?: project.findProperty("newArchEnabled")
?: project.findProperty("newArchEnabled")
if (newArchEnabled == "true") {
def version = getPackageVersionNumber("react-native", project.rootDir)
def isSupported = version == 0 || version >= v(0, 71, 0)
Expand Down

0 comments on commit 8f347f2

Please sign in to comment.