Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

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

Build issues derived from react-native-mmkv-storage #1

Open
pboueke opened this issue Oct 4, 2021 · 0 comments
Open

Build issues derived from react-native-mmkv-storage #1

pboueke opened this issue Oct 4, 2021 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@pboueke
Copy link
Owner

pboueke commented Oct 4, 2021

Build error:

CMake error for using react-native-mmkv-storage with Android.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-mmkv-storage:configureCMakeDebug'.
> C/C++: /home/jawa/Repositories/canto/node_modules/react-native-mmkv-storage/android/src/main/rnmmkv/CMakeLists.txt debug|armeabi-v7a : CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
  Please set them or make sure they are set and tested correctly in the CMake files:
  REACT_NATIVE_JNI_LIB
      linked by target "rnmmkv" in directory /home/jawa/Repositories/canto/node_modules/react-native-mmkv-storage/android/src/main/rnmmkv

Current work-around:

This project uses react-native-mmkv-storage. If the project wont build after following the installation instrunctions, you may need to follow these steps:

  1. In the Android Studio SDK Manager, install CMake 3.10 and make sure it is the only version available.

  2. In the Android Studio Manager, install NDK 21.4.7075529 and make sure it is the only version available.

  3. Specify CMake version at MMKV's build.gradle file.

  • Automated option: run the fix-mmkv script: yarn fix-mmkv (also included in the yarn android script)

  • Manual option: enter node_modules/react-native-mmkv-storage/android/build.gradle and make sure that the CMake version above is specified at externalNativeBuild. Like so:

externalNativeBuild {
    cmake {
        path "./src/main/rnmkv/CMakeLists.txt"
        version "3.10.2"
    }
}

The previous steps came from this related discussion. If they didn´t work, try the following:

4. Delete and reinstall node_modules, apply step 3

5. Clean your project with ./gradlew clean or Android Studio

6. In Android Studio, run Build -> Refresh Linked C++ Projects

The current build process is not deterministic. The previous steps work sometimes, fail others. I am still trying to figure it out. Currently, follow steps 1 to 3 and repeat 5 and 6 untill the project can be built (help needed).

  1. This specific order in Android Studio seems to always work: Build/Clean, Build/Refresh Linked C++ Projects, Build/Make Project, Build/Make Project (yes, build twice, ignore the errors, only the last make should end correctly). Be sure that metro is not running while you do it. Then running yarn android should work.
@pboueke pboueke added bug Something isn't working help wanted Extra attention is needed labels Oct 4, 2021
@pboueke pboueke changed the title Build issues derived from mmkv-storage Build issues derived from react-native-mmkv-storage Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant