Closed hamdij0maa closed 1 year ago
Pull request with the necessary changes seems to be ready already but not yet merged: #480 (0.71 has just been released a couple of hours ago).
you can use an early version from git
yarn add mrousavy/react-native-mmkv#feat/migrate-rn-71
Require to enable
newArchEnabled=true
inandroid/gradle.properties
file
๐๐ผfor Fabric yes, but our need is using RN 0.71.X without Fabric
๐๐ผfor Fabric yes, but our need is using RN 0.71.X without Fabric
Why you can't use the Fabric?
๐๐ผ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
I would also echo the need to continue support for the old architecture. There are a number of react native libraries that can't be updated to the new architecture whilst it does not support static frameworks, e.g. react-native-firebase
@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.
It's not the default :v Fabric renderer is not enabled by default, and most of libs example @FlashList by shopify does not support fabric renderer yet :v
@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.
@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.
Yes, just confirming ๐
Same issue here
RN 0.71 without new architecture :(
When is the new version released?
Please update during the day.
@mrousavy Please any news regarding the fix ?
@mrousavy I need this library in current version (0.71.0). Please I am waiting for an update.
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.
@Titozzz is helping me with the RN 0.71 release. We're working on it (https://github.com/mrousavy/react-native-mmkv/pull/480). It's not as easy as it looks, so be patient. Thanks @Titozzz โค๏ธ
Just published 2.6.0, this should work on RN 0.71 with new and old architecture! ๐ Thanks for your help @Titozzz โค๏ธ
thank you for the update, am getting this error Task :app:mergeLibDexDebug FAILED
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?
Working fine for me, thanks!
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
Did you nuke your gradle cache? https://stackoverflow.com/a/30450020/5281431
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...
Did you nuke your gradle cache? https://stackoverflow.com/a/30450020/5281431
Even though I did a gradlew clean
, still the same problem. :(
Same here,
I cleared all caches and am using the latest version of react-native-mmkv
After upgrading, the error changed. I tested building my app without react-native-mmkv
and it works well, but when I add it back, I encounter the same issue.
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: https://github.com/mrousavy/react-native-mmkv/pull/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 ๐ฅณ
Works like a charm! ๐
Thanks for your PR @inssein - it's weird that I didn't have this error while testing - which other libraries also do the same approach?
Thanks for dealing with that so quickly @mrousavy. As for your question, I looked at https://github.com/software-mansion/react-native-gesture-handler/blob/main/android/build.gradle#L60 and https://github.com/software-mansion/react-native-svg/blob/main/android/build.gradle#L27
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
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.
NDK is not installed
**/node_modules/react-native-mmkv/android/build.gradle' line: 173