react-native-builder-bob icon indicating copy to clipboard operation
react-native-builder-bob copied to clipboard

How to publish android .aar packages?

Open mrousavy opened this issue 4 years ago • 1 comments

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:

Screenshot 2021-02-25 at 09 36 44

I'd like to pre-compile the following files/directories:

  • cpp-adapter.cpp
  • MMKV/Android
  • MMKV/Core
  1. How do I do that? Those 3 files/folders are already mentioned in the CMakeLists.txt, I assume that's enough
  2. What other changes do I need to make? Do I need to add something to the build.gradle?
  3. 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 🤔

mrousavy avatar Feb 25 '21 08:02 mrousavy

hi have you got any solution

asimsagirabbasi avatar May 15 '21 08:05 asimsagirabbasi