Including a prebuilt shared librray in Android.bp

4,015 views
Skip to first unread message

Shalini Salomi Bodapati

unread,
Feb 7, 2020, 2:13:56 PM2/7/20
to Android Building
Hi All,

I facing the below error when trying to add a prebuilt shared library in Android.bp file.

My approach: 

cc_prebuilt_library_shared {
    name: "my-lib",
    srcs: ["path-to-my-lib/my-lib.so"],
}
cc_librray {
   <existing code>
   shared_libs : ["my-lib"],
   include_dirs : ["path to .h files"]
}

module "X" variant "bbbb": depends on non-NDK-built library "my-lib"

Any help is appreciated.

Thanks in Advance!

Dan Willemsen

unread,
Feb 7, 2020, 4:00:33 PM2/7/20
to Android Building
It sounds like your cc_library is setting sdk_version: "XX" (so it's built against the NDK), but your cc_prebuilt_library_shared is not (so it's claiming it was built against the platform APIs, which contains APIs that may change from release to release). If your prebuilt was actually built against the NDK, you should specify which version it was built against. If not, remove the sdk_version from your cc_library.

Also, instead of using `include_dirs` in your cc_library, you can use `export_include_dirs` in your prebuilt library to expose a set of headers to everything that links to that library. We'd eventually like to get rid of include_dirs (not local_include_dirs). See https://android.googlesource.com/platform/build/soong/+/master/docs/best_practices.md#headers for more discussion around this.

- Dan

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/bf51066b-6143-451f-ba11-840af2695d7a%40googlegroups.com.

Shalini Salomi Bodapati

unread,
Feb 10, 2020, 2:02:36 PM2/10/20
to android-...@googlegroups.com
Thanks a lot for helping me understand the error. Works now!

Reply all
Reply to author
Forward
0 new messages