How to add a native prebuilt library with multiple binary files?

I want to built a binary project and add a prebuilt library. This prebuilt library (i.e. Embedded v8 JavaScript Engine) does not only contain of a single .so file, but multiple .a files. I couldn’t figure out how to add it as a library. I ended up with something like:

model {
 repositories {
  libs(PrebuiltLibraries) {
   v8 {
    headers.srcDir "libs/v8/"
     dir: "libs/v8/out/x64.release/",
     include: ["tools/gyp/*.a", "third_party/icu/libicu*.a"],
     exclude: ["tools/gyp/libv8_nosnapshot.a"]
    ).visit { details ->
     if(!details.isDirectory()) {
      binaries.withType(StaticLibraryBinary) {
       staticLibraryFile = details.file

But this way, only the latest *.a file will be linked with the compiled result.

Is this in general the right way to define prebuilt dependencies (somehow looks like I did it a bit too cumbersome)? How can I add a library, that has multiple binary files the right way?

The dependency management for native projects in Gradle is pretty limited at the moment. That’s something we’re planning to address pretty soon.

In the meantime, you’ll need to define each .a file as a separate prebuilt library, and include each of these as a dependency in your project. Alternatively you could merge all of these .a files into a single static library for use with Gradle.