fbjni: Could not find a package configuration file provided by "fbjni"
Issue description
Created a brand new ndk project, CMake reported an error:
Could not find a package configuration file provided by "fbjni" with any of
the following names:
fbjniConfig.cmake
fbjni-config.cmake
Add the installation prefix of "fbjni" to CMAKE_PREFIX_PATH or set
"fbjni_DIR" to a directory containing one of the above files. If "fbjni"
provides a separate development package or SDK, be sure it has been
installed.
Code example
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.10.2)
# Declares and names the project.
project("fbjnitest")
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library( # Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
native-lib.cpp )
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
set(build_DIR ${CMAKE_SOURCE_DIR}/build)
find_package(fbjni REQUIRED CONFIG)
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
native-lib
# Links the target library to the log library
# included in the NDK.
${log-lib}
fbjni::fbjni)
System Info
CMake version: 3.10.2 Gradle Plugin version: 4.1.2 Gradle version: 6.5
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 3
- Comments: 26 (6 by maintainers)
very simple go to build.gradle of project and change enablHermes true -> false…
Adding jcenter() under allprojects in build.gradle worked for me
This works for me too! But, isn’t
jcenter
supposed to be shutting down by February 2022? What’s the root cause of this? Is there a better solution?I think I got this working by adding
I’m not sure yet whether this is a perfect approach, but it builds after cleaning as well as afterward. Changes on my repo.
Just extend android/grafle.properties by adding:
android.prefabVersion=2.0.0
I got this building(I pushed the commit to my repo) more or less doing the same as you, that does not mean I got this fully working as I don’t have a code using fbjni but I’ll try to push something like that, thx anyway. I for sure will leave the repo with the commits ‘before’ and ‘after’ for anyone having similar problems 🙌
Also please, don’t close this issue for now, I’d like to make sure this works and write down some thoughts etc(I know we overcame this particular problem and we could close this and open a new one, but I see you guys don’t have a lot of issues here so maybe we can deal with anything on the way in this one?).
this should reproduce https://github.com/karol-bisztyga/rnfbjni
@karol-bisztyga
I’m definitely open to suggestions here. Sadly the universe of potential Gradle errors is nearly infinite and depends so much on what you are trying to build. If you just google for “duplicate classes gradle” you’ll find an endless stream of cases. We can’t really anticipate every one of them here, but if there’s a particular advice we can give, I’d love to add that to the docs.
@psionic12
The error message isn’t great but by telling you
it’s saying that you need to target a shared C++ runtime. If you add this to your project, it builds: