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

**URL:** <https://discuss.gradle.org/t/how-to-add-a-native-prebuilt-library-with-multiple-binary-files/4211>\
**Category:** Old Forum Archive\
**Created:** [December 29, 2014, 6:19pm UTC](https://discuss.gradle.org/t/how-to-add-a-native-prebuilt-library-with-multiple-binary-files/4211 "2014-12-29T18:19:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_Roes](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/tim_roes/32/107_2.png) [@Tim\_Roes](https://discuss.gradle.org/u/Tim_Roes)\
**Post date:** [December 29, 2014, 6:19pm UTC](https://discuss.gradle.org/t/how-to-add-a-native-prebuilt-library-with-multiple-binary-files/4211/1 "2014-12-29T18:19:00Z")

</div>

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:

```gradle
model {
 repositories {
  libs(PrebuiltLibraries) {
   v8 {
    headers.srcDir "libs/v8/"
    fileTree(
     dir: "libs/v8/out/x64.release/obj.target/",
     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?

---

<div class="post-metadata">

**Author:** ![daz](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/daz/32/2475_2.png) [@daz](https://discuss.gradle.org/u/daz)\
**Post date:** [January 11, 2015, 11:35pm UTC](https://discuss.gradle.org/t/how-to-add-a-native-prebuilt-library-with-multiple-binary-files/4211/2 "2015-01-11T23:35:00Z")

</div>

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.
