添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account tobua, meftunca, mgmaldo, sleaper, capaj, TomasSestak, DarlanCosta, and SanjayKumarCode reacted with thumbs up emoji d-podabed-belitsoft-com and Noitham reacted with heart emoji hamdij0maa and spaceod reacted with rocket emoji All reactions

you can use an early version from git

yarn add mrousavy/react-native-mmkv#feat/migrate-rn-71

Require to enable newArchEnabled=true in android/gradle.properties file

👎🏼for Fabric yes, but our need is using RN 0.71.X without Fabric

Why you can't use the Fabric?

because am using other libs that do not support fabric yet

@mrousavy please do you confirm that the upcoming release will work without enabling Fabric ?
or it will only work with Fabric enabled ?

@hamdij0maa according to this note in the pull request it will only work on 0.71 with fabric enabled:

⚠️ Note: This is a breaking change. react-native-mmkv now only builds on RN 0.71 and above using the new architecture. For the sake of simplicity, it is not backwards compatible.

Meaning if you cannot enable fabric you'll have to stay on 0.70.6. Fabric is now the default architecture for RN, so this breaking change makes sense.

@mrousavy
even enabling fabric I have the same error :
FAILURE: Build failed with an exception.

Where:
Build file '/Users/*****/Desktop/apps/****/node_modules/react-native-mmkv/android/build.gradle' line: 173

What went wrong:
A problem occurred evaluating project ':react-native-mmkv'.

Expected directory '/Users/*****/Desktop/apps/****/node_modules/react-native/android' to contain exactly one file, however, it contains no files.

@hamdij0maa You got a point, didn't know it wasn't already enabled by default.

No prob brother,
we just trying to get it working for all xD
hopefully @mrousavy publish the needed changes soon 🤣

I think y'all missread This is a breaking change. react-native-mmkv now only builds on RN 0.71 and above using the new architecture. For the sake of simplicity, it is not backwards compatible.

If you are on new arch, you'll need 0.71, otherwise you should still be fine. It's just saying that new arch won't work on 0.68, 0.69 and 0.70.

These tags are insanely annoying, stop spamming or I ban you from using RN MMKV.

I am running a company and I am currently busy with a few company related things, I will continue to work on an open-source project I made for free (and none of you guys here are paying me for that) when I have some free time.

I expect this to happen later today.

Task :react-native-mmkv:buildCMakeDebug[x86]
C/C++: ninja: Entering directory `/Users/ /Desktop/apps/ /node_modules/react-native-mmkv/android/.cxx/Debug/71605c37/x86'
@Titozzz do you have an idea how to make it working please?

Thank you very much for the update.

But I am getting an error.

Something is conflicting with the react-native-svg library I understand. :/

Type com.facebook.react.viewmanagers.RNSVGCircleManagerDelegate is defined multiple times: C:\a071a\node_modules\react-native-mmkv\android\build\.transforms\8397d2fe439e7a0cd7a94dd5881d0a19\transformed\classes\classes.dex, C:\a071a\node_modules\react-native-svg\android\build\.transforms\e4553b6d9bb03a5dcd7595790fe41e48\transformed\classes\classes.dex

Thank you very much for the update.

But I am getting an error.

Something is conflicting with the react-native-svg library I understand. :/

same error

same with Type com.facebook.react.viewmanagers.RNGestureHandlerButtonManagerDelegate is defined multiple times: /node_modules/react-native-gesture-handler/android/build/.transforms/9016f10b3bbc73680278818232d909ac/transformed/debug/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.dex, /node_modules/react-native-mmkv/android/build/.transforms/05fe2efb67e79eed93a93868192077d9/transformed/debug/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.dex

same with Type com.facebook.react.viewmanagers.RNGestureHandlerButtonManagerDelegate is defined multiple times: /node_modules/react-native-gesture-handler/android/build/.transforms/9016f10b3bbc73680278818232d909ac/transformed/debug/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.dex, /node_modules/react-native-mmkv/android/build/.transforms/05fe2efb67e79eed93a93868192077d9/transformed/debug/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.dex

That looks like a react-native-gesture-handler error...

RN 0.71.0 - installDebug error - build.gradle line:88 - implementation project(":ReactAndroid") software-mansion/react-native-svg#1966

I'm also getting an error app:mergeLibDexDebug , he is an output from the console:

> Task :react-native-mmkv:configureCMakeDebug[arm64-v8a]
C/C++: CMake Warning at /Users/user/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android-legacy.toolchain.cmake:416 (message):
C/C++:   An old version of CMake is being used that cannot automatically detect
C/C++:   compiler attributes.  Compiler identification is being bypassed.  Some
C/C++:   values may be wrong or missing.  Update to CMake 3.19 or newer to use
C/C++:   CMake's built-in compiler identification.
C/C++: Call Stack (most recent call first):
C/C++:   /Users/user/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake:55 (include)
C/C++:   .cxx/Debug/6r5g1950/arm64-v8a/CMakeFiles/3.18.1-g262b901/CMakeSystem.cmake:6 (include)
C/C++:   CMakeLists.txt:1 (project)
> Task :app:mergeLibDexDebug FAILED
> Task :react-native-mmkv:buildCMakeDebug[arm64-v8a]
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
182 actionable tasks: 4 executed, 178 up-to-date
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
ERROR:/app/node_modules/react-native-mmkv/android/build/.transforms/3f9c1da8ef9e9dd791ea35eabfde5b34/transformed/classes/classes.dex: D8: Type com.facebook.react.viewmanagers.RNCSafeAreaProviderManagerDelegate is defined multiple times: /app/node_modules/react-native-mmkv/android/build/.transforms/3f9c1da8ef9e9dd791ea35eabfde5b34/transformed/classes/classes.dex, /app/node_modules/react-native-safe-area-context/android/build/.transforms/c6786e6fef212d007103008b90ae9725/transformed/classes/classes.dex
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
Type com.facebook.react.viewmanagers.RNCSafeAreaProviderManagerDelegate is defined multiple times: /app/node_modules/react-native-mmkv/android/build/.transforms/3f9c1da8ef9e9dd791ea35eabfde5b34/transformed/classes/classes.dex, /app/node_modules/react-native-safe-area-context/android/build/.transforms/c6786e6fef212d007103008b90ae9725/transformed/classes/classes.dex
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
	at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:151)
	at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:138)
	at com.android.build.gradle.internal.tasks.DexMergingWorkAction.merge(DexMergingTask.kt:859)
          

I get the same error as @mikalaiulasevich:

Type com.facebook.react.viewmanagers.RNGestureHandlerButtonManagerDelegate is defined multiple times: /Users/inssein/projects/dittoed/app/node_modules/react-native-gesture-handler/android/build/.transforms/d613df52358496bff3ffec7f5dc6fdeb/transformed/debug/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.dex, /Users/inssein/projects/dittoed/app/node_modules/react-native-mmkv/android/build/.transforms/2eb4a9494d7d6ffad6931f884f14eca1/transformed/debug/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.dex

Edit: Don't think its a problem with react native gesture handler. For some reason, when this library builds, it has a lot of viewmanagers compiled that aren't from this library.

@mrousavy looks like the issue was with the build.gradle. I'm pretty new to this, but I just happened to look at the build.gradle of other libraries and caught the fact that other libraries were only doing apply plugin: 'com.facebook.react' if
isNewArchitectureEnabled, like so:

if (isNewArchitectureEnabled()) {
    apply plugin: 'com.facebook.react'

I can open a PR if that's correct.

Edit: PR: #499. Feel free to close if not relevant.

Very interesting.

Although newArchEnabled=false in android/gradle.properties it was always going into this if. 🤔

apply plugin: 'com.facebook.react' I completely deleted this and it works, amazing. Thanks @inssein 🥳

FAILURE: Build failed with an exception.
A problem occurred configuring project ':react-native-mmkv'.

org.gradle.api.InvalidUserDataException: NDK is not installed

[CXX1101] NDK at C:\Users\Your\AppData\Local\Android\Sdk\ndk\23.1.7779620 did not have a source.properties file

build failed as ndk already installed

RN-0.71.1
"react-native-mmkv": "^2.6.1",
newArchEnabled=false in android/gradle.properties

@inssein what are the changes need to do...
cheers-:)resolved

Configure project :react-native-mmkv
[CXX1101] NDK at /Users/chukwuebuka/Library/Android/sdk/ndk/24.0.8215888 did not have a source.properties file
[CXX1101] NDK at /Users/chukwuebuka/Library/Android/sdk/ndk/24.0.8215888 did not have a source.properties file

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':react-native-mmkv'.
  • NDK is not installed