ammarahm-ed / react-native-mmkv-storage

An ultra fast (0.0002s read/write), small & encrypted mobile key-value storage framework for React Native written in C++ using JSI
https://rnmmkv.now.sh
MIT License
1.58k stars 109 forks source link

Null Pointer Exception On expo run:android for expo sdk 45 [Bug] #268

Closed mfharding closed 2 years ago

mfharding commented 2 years ago

Describe the bug I am using the bare workflow with expo sdk 55. I am getting a null point exception when running ./gradlew assembleRelease or expo run:android. I am getting this issue with react-native-mmkv and react-native-mmkv-storage, when used seperately.

I am also using the expo prebuild command.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior Android should build

Platform Information:

Additional context `* What went wrong: A problem occurred configuring project ':react-native-mmkv'.

java.lang.NullPointerException

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/ 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.3.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 17s 6 actionable tasks: 6 up-to-date /Users/michaelharding/apps/Lets-Roam-App/android/gradlew exited with non-zero code: 1 Error: /Users/michaelharding/apps/Lets-Roam-App/android/gradlew exited with non-zero code: 1 at ChildProcess.completionListener (/Users/michaelharding/.nvm/versions/node/v16.13.2/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13) at Object.onceWrapper (node:events:510:26) at ChildProcess.emit (node:events:390:28) at maybeClose (node:internal/child_process:1064:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) ... at spawnAsync (/Users/michaelharding/.nvm/versions/node/v16.13.2/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19) at spawnGradleAsync (/Users/michaelharding/.nvm/versions/node/v16.13.2/lib/node_modules/expo-cli/src/commands/run/android/spawnGradleAsync.ts:83:18) at assembleAsync (/Users/michaelharding/.nvm/versions/node/v16.13.2/lib/node_modules/expo-cli/src/commands/run/android/spawnGradleAsync.ts:57:16) at actionAsync (/Users/michaelharding/.nvm/versions/node/v16.13.2/lib/node_modules/expo-cli/src/commands/run/android/runAndroid.ts:143:9) `

Here is a snippet of my package.json "eslint": "^8.11.0", "expo": "^45.0.0", "react-native": "0.68.2", "react-native-mmkv-storage": "^0.7.6",

mfharding commented 2 years ago

Solved my own issue.

I had 2 versions of cmake installed. What is Cmake you might ask. Its what builds packages like these in android. If you see java.langauge.nullPointerException on android build, its probably a cmake issue. On mac the right cmake is this: /usr/local/bin/cmake. Type which cmake to test.

Just delete any others or this. Not sure what it actually does.