react-native-mmkv: React Native MMKV fails to build due to fbjni-0.5.0-headers.jar responding with 404

Issue description

When deploying our React Native 0.70.6 app to Android through Fastlane we’re now getting failed builds with the following error;

Please refer to my issue created in FBJNI-repo and this comment.

Where:

Build file ‘node_modules/react-native-mmkv/android/build.gradle’ line: 322

What went wrong:

Execution failed for task ':react-native-mmkv:extractAARHeaders'.
> Could not resolve all files for configuration ':react-native-mmkv:extractHeaders'.
   > Could not find fbjni-0.5.0-headers.jar (com.facebook.fbjni:fbjni:0.5.0).
     Searched in the following locations:
         https://repo.maven.apache.org/maven2/com/facebook/fbjni/fbjni/0.5.0/fbjni-0.5.0-headers.jar

When looking through https://repo.maven.apache.org/maven2/com/facebook/fbjni/fbjni we see that the headers file is missing only for version 0.5.0.

https://repo.maven.apache.org/maven2/com/facebook/fbjni/fbjni/0.5.0/fbjni-0.5.0-headers.jar responds in 404.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 23
  • Comments: 28 (1 by maintainers)

Most upvoted comments

I tried the following steps and it worked for me

  • Delete gradle cache
  • Restart the system
  • gradle clean And it worked

Please add the respective commands (macOS/Unix) to your post. I would be grateful

Env: MacOS M1 Ventura 13.4.1 (22F82) Delete gradle cache: rm -rf ~/.gradle/caches Restart system Gradle clean: cd android && ./gradlew clean Build again: ./gradlew :app:assembleRelease

You will have to clean yarn & gradle cache and try again

Already did and still fails

patch (with patch-package) react-native-mmkv/android/build.gradle

   //noinspection GradleDynamicVersion
-  extractHeaders("com.facebook.fbjni:fbjni:+:headers")
+  extractHeaders("com.facebook.fbjni:fbjni:0.4.0:headers")
   //noinspection GradleDynamicVersion
-  extractJNI("com.facebook.fbjni:fbjni:+")
+  extractJNI("com.facebook.fbjni:fbjni:0.4.0")

Any updates? Even after they fixed the fbjni release, the error remains 😦

Hey!

Yea the latest version of react-native-mmkv fixes this issue, make sure y’all upgrade to 2.10.1! 😃

I tried the following steps and it worked for me

  • Delete gradle cache
  • Restart the system
  • gradle clean And it worked

./gradlew :app:assembleRelease

I can confirm this solution results in a successful build, Thank you @paryanihitesh and @stiltet-gofore

The patch-package worked. However the core problem with React Native MMKV using a dynamic range of FBJNI still needs to be resolved, because even with the patch the risk of runtime crashes exists as described here; https://github.com/facebookincubator/fbjni/issues/85#issuecomment-1647826877

You will have to clean yarn & gradle cache and try again