4

I have 2 projects:

  • A static libray libSL.a built with the NDK r9 and Android.mk.
  • An Android Studio project containing:
    • WL.java (a JNI wrapper around libWL.so).
    • jniWL.h and jni/WL.c (libWL.so's source code), which require libSL.a.
    • lib/libWL.so.

How do I include libSL.a into libWL.so with Gradle's Native Binary support?

Vincent Cantin
  • 16,192
  • 2
  • 35
  • 57
David Andreoletti
  • 4,485
  • 4
  • 29
  • 51

1 Answers1

0

To include static library you need to add it at linking stage as parameter for linker. It should not matter if target is shared lib or executable. I used

ndk {
    ...
    ldLibs "/some/path/libs/libcurl.a", "z", "log", "android", "EGL", "GLESv2", "OpenSLES"
}

in my project. And also:

 stl "gnustl_static"

And that gave me native .so module.

Victor Laskin
  • 2,577
  • 2
  • 16
  • 10