Skip to content

Commit 43e68b5

Browse files
authored
feat: Use our MMKV fork to support 32-bit again (#887)
* feat: User @Goooler's fork to support 32-bit again * fix: Build Example for 32-bit again * fix: Usage * fix: Use MMKV from Wu * fix: Wrong spec
1 parent 62a1615 commit 43e68b5

5 files changed

Lines changed: 3 additions & 73 deletions

File tree

docs/V4_UPGRADE_GUIDE.md

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,6 @@ npm install react-native-nitro-modules
2424

2525
> Nitro requires **react-native 0.75.0** or higher. See [the Troubleshooting guide](https://nitro.margelo.com/docs/troubleshooting) if you run into any issues.
2626
27-
### MMKV Core drops support for 32-bit architectures
28-
29-
Due to security and performance concerns, MMKV Core now dropped support for 32-bit architectures on Android. In our testings, this affected ~0.1% of the users in a large production app.
30-
In your `gradle.properties` file, remove all 32-bit architectures from the `reactNativeArchitectures` array:
31-
```diff
32-
- reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
33-
+ reactNativeArchitectures=arm64-v8a,x86_64
34-
```
35-
36-
See [Android: Prerequisites](https://github.com/Tencent/MMKV/wiki/android_setup#prerequisites) for more information.
37-
3827
### `new MMKV(...)` -> `createMMKV(...)`
3928

4029
The `MMKV` JS-class no longer exists - instead it is now purely native. This means, you have to change your MMKV creation code:
@@ -65,33 +54,6 @@ To better comply with Apple's naming, I changed the `AppGroup` key to `AppGroupI
6554

6655
## Troubleshooting
6756

68-
### Android build failed: `Could not find a package configuration file provided by "mmkv" with any of the following names`
69-
70-
If you get a build error on Android that looks something like this:
71-
72-
```
73-
C/C++: CMake Error at /Users/mrousavy/example/node_modules/react-native-mmkv/android/CMakeLists.txt:24 (find_package):
74-
C/C++: Could not find a package configuration file provided by "mmkv" with any of
75-
C/C++: the following names:
76-
C/C++: mmkvConfig.cmake
77-
C/C++: mmkv-config.cmake
78-
C/C++: Add the installation prefix of "mmkv" to CMAKE_PREFIX_PATH or set
79-
C/C++: "mmkv_DIR" to a directory containing one of the above files. If "mmkv"
80-
C/C++: provides a separate development package or SDK, be sure it has been
81-
C/C++: installed.
82-
```
83-
84-
..or like this:
85-
86-
```
87-
Task :react-native-mmkv:configureCMakeDebug[armeabi-v7a] FAILED
88-
C/C++: /Users/mrousavy/Projects/ShadowLens/node_modules/react-native-mmkv/android/CMakeLists.txt debug|armeabi-v7a : com.google.prefab.api.NoMatchingLibraryException: No compatible library found for //mmkv/mmkv. Rejected the following libraries:
89-
```
90-
91-
..make sure that you removed the 32-bit architectures from your `gradle.properties` file, clean your cache and try again. (See [MMKV Core drops support for 32-bit architectures](#mmkv-core-drops-support-for-32-bit-architectures))
92-
93-
As long as you see `armeabi-v7a` in your build logs, you haven't properly removed the 32-bit build configuration.
94-
9557
### iOS build failed: `The following Swift pods cannot yet be integrated as static libraries`
9658

9759
If you get an iOS `pod install` error that looks like this:

example/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ android.useAndroidX=true
2525
# Use this property to specify which architecture you want to build.
2626
# You can also override it from the CLI using
2727
# ./gradlew <task> -PreactNativeArchitectures=x86_64
28-
reactNativeArchitectures=arm64-v8a,x86_64
28+
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
2929

3030
# Use this property to enable support to the new architecture.
3131
# This will allow you to use TurboModules and the Fabric render in

packages/react-native-mmkv/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ buildscript {
1111

1212
def reactNativeArchitectures() {
1313
def value = rootProject.getProperties().get("reactNativeArchitectures")
14-
return value ? value.split(",") : ["x86_64", "arm64-v8a"]
14+
return value ? value.split(",") : ["x86", "x86_64", "armeabi-v7a", "arm64-v8a"]
1515
}
1616

1717
def isNewArchitectureEnabled() {
@@ -139,6 +139,6 @@ dependencies {
139139
implementation project(":react-native-nitro-modules")
140140

141141
// Add a dependency on mmkv core (this ships a C++ prefab)
142-
implementation "com.tencent:mmkv-shared:2.2.3"
142+
implementation "io.github.zhongwuzw:mmkv:2.2.3.1"
143143
}
144144

packages/react-native-mmkv/app.plugin.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/react-native-mmkv/src/expo-plugin/withMMKV.cts

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)