Closed pnthach95 closed 1 year ago
There's an open PR that fixes this: #305
If you use patch-package you can apply this patch in the mean time:
@robrechtme thanks for the patch. i'm getting the following errors when running yarn
**ERROR** Failed to apply patch for package react-native-mmkv-storage
This happened because the patch file patches/react-native-mmkv-storage+0.8.0.patch could not be parsed.
If you just upgraded patch-package, you can try running:
patch -p1 -i patches/react-native-mmkv-storage+0.8.0.patch
npx patch-package react-native-mmkv-storage
Otherwise, try manually creating the patch file again.
If the problem persists, please submit a bug report:
https://github.com/ds300/patch-package/issues/new?title=Patch+file+parse+error&body=%3CPlease+attach+the+patch+file+in+question%3E
and then when i try to run the patch command
> patch -p1 -i patches/react-native-mmkv-storage+0.8.0.patch
patching file 'node_modules/react-native-mmkv-storage/android/build.gradle'
patch: **** malformed patch at line 8: buildscript {
Looks like github comments mangles the format... I went to the pull request and got the two files in robrechtme's patch and created it myself. Here's a gist:
https://gist.github.com/warrenfalk/97702b3908fdb23b6ae8d1bdcdf62316
After applying the patch I am still getting the error below. Please help. Using react-native v0.71.3
`error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build completed with 2 failures.
What went wrong: Execution failed for task ':react-native-mmkv-storage:configureCMakeDebug[arm64-v8a]'.
[CXX1405] error when building with cmake using /Users/jshewiyo/Desktop/PROJECTS/otr/otr-app/otr/node_modules/react-native-mmkv-storage/android/src/main/rnmmkv/CMakeLists.txt: -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /Users/jshewiyo/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Users/jshewiyo/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- The ASM compiler identification is Clang -- Found assembler: /Users/jshewiyo/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -- Configuring done -- Generating done
C++ build system [configure] failed while executing: /Users/jshewiyo/Library/Android/sdk/cmake/3.18.1/bin/cmake \ -H/Users/jshewiyo/Desktop/PROJECTS/otr/otr-app/otr/node_modules/react-native-mmkv-storage/android/src/main/rnmmkv \ -DCMAKE_SYSTEM_NAME=Android \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DCMAKE_SYSTEM_VERSION=21 \ -DANDROID_PLATFORM=android-21 \ -DANDROID_ABI=arm64-v8a \ -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \ -DANDROID_NDK=/Users/jshewiyo/Library/Android/sdk/ndk-bundle \ -DCMAKE_ANDROID_NDK=/Users/jshewiyo/Library/Android/sdk/ndk-bundle \ -DCMAKE_TOOLCHAIN_FILE=/Users/jshewiyo/Library/Android/sdk/ndk-bundle/build/cmake/android.toolchain.cmake \ -DCMAKE_MAKE_PROGRAM=/Users/jshewiyo/Library/Android/sdk/cmake/3.18.1/bin/ninja \ "-DCMAKE_CXX_FLAGS=-O2 -frtti -fexceptions -Wall -Wno-unused-variable -fstack-protector-all" \ -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/jshewiyo/Desktop/PROJECTS/otr/otr-app/otr/node_modules/react-native-mmkv-storage/android/build/intermediates/cxx/Debug/6b5w7110/obj/arm64-v8a \ -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/jshewiyo/Desktop/PROJECTS/otr/otr-app/otr/node_modules/react-native-mmkv-storage/android/build/intermediates/cxx/Debug/6b5w7110/obj/arm64-v8a \ -DCMAKE_BUILD_TYPE=Debug \ -B/Users/jshewiyo/Desktop/PROJECTS/otr/otr-app/otr/node_modules/react-native-mmkv-storage/android/.cxx/Debug/6b5w7110/arm64-v8a \ -GNinja \ -DANDROID_STL=c++_shared from /Users/jshewiyo/Desktop/PROJECTS/otr/otr-app/otr/node_modules/react-native-mmkv-storage/android CMake Warning at /Users/jshewiyo/Library/Android/sdk/ndk-bundle/build/cmake/android.toolchain.cmake:63 (message): Using custom NDK path (ANDROID_NDK is set): /Users/jshewiyo/Library/Android/sdk/ndk-bundle Call Stack (most recent call first): /Users/jshewiyo/Library/Android/sdk/cmake/3.18.1/share/cmake-3.18/Modules/CMakeDetermineSystem.cmake:93 (include) CMakeLists.txt:5 (project)
CMake Error at CMakeLists.txt:17 (add_library): Target "rnmmkv" links to target "ReactAndroid::jsi" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
CMake Generate step failed. Build files cannot be regenerated correctly.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
What went wrong: java.lang.StackOverflowError (no error message)
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 12s
at makeError (/Users/jshewiyo/Desktop/PROJECTS/otr/otr-app/otr/node_modules/execa/index.js:174:9)
at /Users/jshewiyo/Desktop/PROJECTS/otr/otr-app/otr/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/jshewiyo/Desktop/PROJECTS/otr/otr-app/otr/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:82:7)
at async Command.handleAction (/Users/jshewiyo/Desktop/PROJECTS/otr/otr-app/otr/node_modules/@react-native-community/cli/build/index.js:108:9)
info Run CLI with --verbose flag for more details.`
Fixed in 0.9.0.
Unfortunately, the update did not work for me using react native v0.71.3. I am therefore forced to resort to the other plugin.
Unfortunately, the update did not work for me using react native v0.71.3. I am therefore forced to resort to the other plugin.
Hmmm strange 🤔 i tested on a clean android project and everything worked and app is built. React Native version is latest.
I can confirm v0.9.1 work on RN 0.71.4 https://github.com/pnthach95/mmkvtest/tree/rn71
Describe the bug RN 0.71 has a lot of change in android folder, so I try to run it with mmkv-storage and it is failed.
To Reproduce Steps to reproduce the behavior:
npx react-native init RN0710RC4 --version 0.71.0-rc.4
yarn run android
Expected behavior Build success and install app to phone and run.
Screenshots I have log
Platform Information:
Additional context The log is same as #165 Although it is RC release, things may be changed in official release, you should have future-proof solution.