react-native-mmkv-storage: Android build fails

react-native 0.63.4 react-native-mmkv-storage 0.6.3

* What went wrong:
Execution failed for task ':react-native-mmkv-storage:externalNativeBuildRelease'.
> Build command failed.
  Error while executing process /usr/local/lib/android/sdk/cmake/3.10.2.4988404/bin/ninja with arguments ***-C /home/runner/work/reactnative-app/reactnative-app/node_modules/react-native-mmkv-storage/android/.cxx/cmake/release/armeabi-v7a rnmmkv***
  ninja: Entering directory `/home/runner/work/reactnative-app/reactnative-app/node_modules/react-native-mmkv-storage/android/.cxx/cmake/release/armeabi-v7a'
...
[37/37] Linking CXX shared library /home/runner/work/reactnative-app/reactnative-app/node_modules/react-native-mmkv-storage/android/build/intermediates/cmake/release/obj/armeabi-v7a/librnmmkv.so
  FAILED: /home/runner/work/reactnative-app/reactnative-app/node_modules/react-native-mmkv-storage/android/build/intermediates/cmake/release/obj/armeabi-v7a/librnmmkv.so 
  : && /usr/local/lib/android/sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi21 --gcc-toolchain=/usr/local/lib/android/sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/usr/local/lib/android/sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -fexceptions -frtti -std=c++1y -DONANDROID -Oz -DNDEBUG  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,librnmmkv.so -o /home/runner/work/reactnative-app/reactnative-app/node_modules/react-native-mmkv-storage/android/build/intermediates/cmake/release/obj/armeabi-v7a/librnmmkv.so CMakeFiles/rnmmkv.dir/rnmmkv-adapter.cpp.o  /usr/local/lib/android/sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/21/liblog.so /home/runner/work/reactnative-app/reactnative-app/node_modules/react-native-mmkv-storage/android/build/react-native-0.63.4.aar/jni/armeabi-v7a/libreactnativejni.so core/libcore.a -landroid /usr/local/lib/android/sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libz.a -latomic -lm && :
  ld: error: undefined symbol: facebook::jsi::Value::~Value()
  >>> referenced by jsi-inl.h:112 (/home/runner/work/reactnative-app/reactnative-app/android/../node_modules/react-native/ReactCommon/jsi/jsi/jsi-inl.h:112)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 34 (16 by maintainers)

Most upvoted comments

I am also getting same problem ,I tried all solution above but not work for me ,any ldea for help me?

Execution failed for task ':app:configureCMakeDebug[arm64-v8a]'.
> [CXX1405] error when building with cmake using C:\project\flutter_ffi_example\android\CMakeLists.txt: Build command failed.

Okay,

I found it. It simply does not work with lower and higher than 3.10.2.4988404 CMake version.

Also, in the local.properties file, I had to define cmake path:

cmake.dir=/Users/username/Library/Android/sdk/cmake/3.10.2.4988404

Thank you so much for the live help and the support for the library @ammarahm-ed 😃

I’m getting a similar error.

* What went wrong:
Execution failed for task ':react-native-mmkv-storage:externalNativeBuildRelease'.
> Build command failed.
  Error while executing process C:\Users\username\AppData\Local\Android\Sdk\cmake\3.10.2.4988404\bin\ninja.exe with arguments {-C C:\Users\username\Documents\Coding\ReactNative\appname\node_modules\react-native-mmkv-storage\android\.cxx\cmake\release\armeabi-v7a rnmmkv}
  ninja: Entering directory `C:\Users\username\Documents\Coding\ReactNative\appname\node_modules\react-native-mmkv-storage\android\.cxx\cmake\release\armeabi-v7a'
  [1/1] Linking CXX shared library C:\Users\username\Documents\Coding\ReactNative\appname\node_modules\react-native-mmkv-storage\android\build\intermediates\cmake\release\obj\armeabi-v7a\librnmmkv.so
  FAILED: C:/Users/username/Documents/Coding/ReactNative/appname/node_modules/react-native-mmkv-storage/android/build/intermediates/cmake/release/obj/armeabi-v7a/librnmmkv.so
  cmd.exe /C "cd . && C:\Users\username\AppData\Local\Android\Sdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi16 --gcc-toolchain=C:/Users/username/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=C:/Users/username/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -fexceptions -frtti -std=c++1y -DONANDROID -Oz -DNDEBUG  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,librnmmkv.so -o C:\Users\username\Documents\Coding\ReactNative\appname\node_modules\react-native-mmkv-storage\android\build\intermediates\cmake\release\obj\armeabi-v7a\librnmmkv.so CMakeFiles/rnmmkv.dir/rnmmkv-adapter.cpp.o -LC:/Users/username/Documents/Coding/ReactNative/appname/node_modules/react-native-mmkv-storage/android/build/react-native-0.63.4.aar/jni/armeabi-v7a -llog -lreactnativejni core/libcore.a -landroid C:/Users/username/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/arm-linux-androideabi/libz.a -latomic -lm && cd ."
  C:/Users/username/Documents/Coding/ReactNative/appname/node_modules/react-native-mmkv-storage/android/../../../node_modules/react-native/ReactCommon/jsi\jsi/jsi-inl.h:112: error: undefined reference to 'facebook::jsi::Value::~Value()'
  C:/Users/username/Documents/Coding/ReactNative/appname/node_modules/react-native-mmkv-storage/android/../../../node_modules/react-native/ReactCommon/jsi\jsi/jsi-inl.h:112: error: undefined reference to 'facebook::jsi::Value::~Value()'
  C:/Users/username/Documents/Coding/ReactNative/appname/node_modules/react-native-mmkv-storage/android/../../../node_modules/react-native/ReactCommon/jsi\jsi/jsi.h:966: error: undefined reference to 'facebook::jsi::Value::~Value()'
  C:/Users/username/Documents/Coding/ReactNative/appname/node_modules/react-native-mmkv-storage/android/../../../node_modules/react-native/ReactCommon/jsi\jsi/jsi.h:961: error: undefined reference to 'facebook::jsi::Value::~Value()'
  C:/Users/username/Documents/Coding/ReactNative/appname/node_modules/react-native-mmkv-storage/android/../../../node_modules/react-native/ReactCommon/jsi\jsi/jsi-inl.h:205: error: undefined reference to 'facebook::jsi::Value::~Value()'
  C:/Users/username/Documents/Coding/ReactNative/appname/node_modules/react-native-mmkv-storage/android/../../../node_modules/react-native/ReactCommon/jsi\jsi/jsi-inl.h:205: error: undefined reference to 'facebook::jsi::Value::~Value()'
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

Using react-native-mmkv-storage@0.6.4, react-native@0.63.4, CMake 3.10.2.4988404, NDK 21.4.7075529, and the build.gradle change described here. No other JSI packages. I’ve tried deleting node_modules and running ./gradlew.bat clean, didn’t change anything. However, downgrading to react-native-mmkv-storage@0.6.0 works.

It should work. Maybe something greater than 3.18 would work fine.

CleanShot 2021-09-22 at 23 07 07@2x

@ammarahm-ed Can you tell me where to upgrade it?

Uncheck cmake 3.6.x. Apply changes.