Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sample for ldFlags #26

Closed
Nimrodda opened this issue Jul 11, 2015 · 7 comments
Closed

Add sample for ldFlags #26

Nimrodda opened this issue Jul 11, 2015 · 7 comments

Comments

@Nimrodda
Copy link

In traditional NDK make file, I can link a prebuilt static library and specify its headers directory:
Android.mk

include $(CLEAR_VARS)
LOCAL_MODULE            := somelibrary-prebuilt-static
LOCAL_SRC_FILES         := $(TARGET_ARCH_ABI)/libsomelibrary.a
LOCAL_EXPORT_C_INCLUDES := include 
include $(PREBUILT_STATIC_LIBRARY)

How do I do that in build.gradle using the new plugin's DSL?

@proppy
Copy link
Contributor

proppy commented Jul 13, 2015

@Nimrodda you can use ldFlags directive, see https://code.google.com/p/android/issues/detail?id=177628.

Updating this issue to request a new sample for showing the proper syntax.

@proppy proppy changed the title Linking a prebuilt library Add sample for ldFlags Jul 13, 2015
@proppy
Copy link
Contributor

proppy commented Jul 13, 2015

Also note #27 build.gradle doesn't yet support building separate library, so you would have to build the standalone library with Android.mk before referencing it with ldFlags.

@Nimrodda
Copy link
Author

Thanks for your answer.
Can you paste an example of how to use ldFlags directive with pre-built static lib, taking into account different TARGET_ARCH_ABIs?
Also, in previous revision there used to be jniLibs folder for that purpose. Is it now dropped completely?

@proppy
Copy link
Contributor

proppy commented Aug 21, 2015

@Nimrodda http://tools.android.com/tech-docs/new-build-system/gradle-experimental has an example using ldFlags.

It doesn't show how to handle this for different TARGET_ARCH_ABI thought, let's ping @rschiu he recently made a change that should enable this:
https://android-review.googlesource.com/#/c/155834/5

@rschiu
Copy link
Contributor

rschiu commented Aug 21, 2015

If you have one ABI per flavor, you can specify the ldLibs for that flavor. If you have an apk with multiple ABI, you will need to wait for https://code.google.com/p/android/issues/detail?id=178074 to be resolved, which should be available in the next release.

@rschiu
Copy link
Contributor

rschiu commented Aug 21, 2015

Also, jniLibs should still work. .so in src/main/jniLibs should be packaged into the apk. Does it not?

@proppy
Copy link
Contributor

proppy commented Nov 17, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants