react-native-vision-camera: đ Can not build for android - Could not find fbjni-0.5.0-headers.jar
What were you trying to do?
Without changing anything during the last few days, now out of a sudden, the build doesnât work. I get the some errors regarding maven.
Reproduceable Code
I stuck in the build time
What happened instead?
Unable to build
Relevant log output
* What went wrong:
Execution failed for task ':react-native-vision-camera:extractAARHeaders'.
> Could not resolve all files for configuration ':react-native-vision-camera: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
Device
Android 11
VisionCamera Version
2.13.3 (also tested the latest version)
Additional information
- I am using Expo
- I have read the Troubleshooting Guide
- I agree to follow this projectâs Code of Conduct
- I searched for similar issues in this repository and found none.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 10
- Comments: 19 (3 by maintainers)
If you change these two lines in node_modules/react-native-vision-camera/android/build.gradle
you can build your project successfully
I have raised a PR to this repo which changes the import of fbjni to explicitly define version 4 as the dependency. This should really be the case anyway, to save this scenario from happening in the future.
#1666
You can use patch-package to keep the changes around, but it will bloat your VCS a bit.
@carolinaknoll thanks for the clarification. I noticed the 0.5.1 update had been published. If your builds still donât work it may be a caching issue. Worth busting the gradle caches⊠or run something like
./gradlew assembleDebug --refresh-dependencies
<< worked for me.@domthomhive Iâve also been reading through the issue in fbjniâs own thread. From what I understand, when the owner released v0.5.0, he forgot to add the headers. So you can have a react native project that has the following lines, either on
android/app/build.gradle
or inside a dependency likenode_modules/<dependency_name>/app/build.gradle
.These lines make it so that these projects can get the latest version of
fbjni
automatically, since they donât assign a particular version offbjni
to use. However, asv0.5.0
doesnât have the headers, the project build fails because of it.The owner has released
v0.5.1
which has the headers. But as @fendorio said, this this same issue can happen in the future, because again, there are these lines of code saying âget the latest version automatically, regardless if it is available/has everything it needs or notâ.Strangely, I thought that by using these lines we would start to get
v0.5.1
automatically so that the error would go away and the projects would build correctly again, which doesnât seem to be the case. My project is still failing to build, as one of itâs dependencies is still looking forv0.5.0
and notv0.5.1
. đ€Ultimately, I agree that we can use patch-package to fix this issue without waiting for more changes.
Itâs great that a fix has been deployed upstream, however, this library should still be patched to explicitly define the dependency version, as to avoid the same situation occurring again.
It worked. As of now, version 0.5.0 of fbjni-java is not available.
I added this section in the android/build.gradle file, Itâs a slightly cleaner approach.
It worked. Ty man.
here itâs back to normal
I only tried to alter the extractJNI, didnât think to also change extractHeaders. Thanks. đđ»
I guess fbjni 0.5.0 is breaking (allowed by semantic version change) but this library does not specify a correct version range.
https://github.com/mrousavy/react-native-vision-camera/blob/3ed019d018cce9ff20afb0fcc81146732419f17e/android/build.gradle#L291C1-L295C47