react-native-builder-bob
react-native-builder-bob copied to clipboard
How to publish android .aar packages?
Ask your Question
What do I need to do to publish android .aar packages?
I have a package that contains a lot of native (.cpp) code, which I'd like to pre-build for the user.
My android folder in my react-native library looks like this:

I'd like to pre-compile the following files/directories:
-
cpp-adapter.cpp -
MMKV/Android -
MMKV/Core
- How do I do that? Those 3 files/folders are already mentioned in the CMakeLists.txt, I assume that's enough
- What other changes do I need to make? Do I need to add something to the
build.gradle? - What files to I have to publish to npm? I currently have:
{
"files": [
"android/src",
"android/build.gradle",
"android/gradle.properties",
"lib/aar",
"lib/commonjs",
"lib/module",
"lib/typescript",
"ios/**/*.h",
"ios/**/*.m",
"ios/**/*.mm",
"ios/**/*.cpp",
"react-native-mmkv.podspec",
"README.md"
],
}
but that doesn't work since it can't find the CMakeLists.txt I mentioned in my build.gradle. If I add the CMakeLists.txt it complains since it can't find the .cpp files. If I remove android/ entirely, it simply doesn't use the native module.
I believe it simply ignores the lib/aar folder 🤔
hi have you got any solution