Skip to content

Commit 2b70c4f

Browse files
committed
fix build failing on RN 0.69
1 parent 2f440d7 commit 2b70c4f

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

android/build.gradle

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import groovy.json.JsonSlurper
2+
13
buildscript {
24

35
repositories {
@@ -50,6 +52,12 @@ if (reactNativeDir.exists()) {
5052
})
5153
}
5254

55+
def reactNative = reactNativeDir.absolutePath;
56+
def reactNativeManifest = file("$reactNative/../package.json")
57+
def reactNativeManifestAsJson = new JsonSlurper().parseText(reactNativeManifest.text)
58+
def reactNativeVersion = reactNativeManifestAsJson.version as String
59+
def (major, minor, patch) = reactNativeVersion.tokenize('.')
60+
def rnMinorVersion = Integer.parseInt(minor)
5361

5462
android {
5563
compileSdkVersion getExtOrDefault('compileSdkVersion', 28)
@@ -116,9 +124,18 @@ dependencies {
116124
implementation 'com.facebook.react:react-native:+'
117125
implementation "androidx.security:security-crypto:1.1.0-alpha03"
118126
implementation 'com.google.code.gson:gson:2.8.6'
127+
def buildType = "debug"
128+
tasks.all({ task ->
129+
if (task.name == "buildCMakeRelease") {
130+
buildType = "release"
131+
}
132+
})
133+
def rnAarMatcher = "**/react-native/**/*${buildType}.aar"
134+
if (rnMinorVersion < 69) {
135+
rnAarMatcher = "**/**/*.aar"
136+
}
119137

120-
def rnAAR = fileTree(reactNativeDir.toString()).matching({ it.include "**/**/*.aar" }).singleFile
121-
138+
def rnAAR = fileTree("$reactNative").matching({ it.include rnAarMatcher }).singleFile
122139
files(rnAAR).each {
123140
def file = it.absoluteFile
124141
def aarFolder = new File("$buildDir/../$file.name");

android/src/main/rnmmkv/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
cmake_minimum_required(VERSION 3.9.0)
22

3+
34
set (PACKAGE_NAME "rnmmkv")
5+
project(PACKAGE_NAME)
46
set (BUILD_DIR ../../../)
57

68
add_subdirectory(../../../../MMKV/Core core)

0 commit comments

Comments
 (0)