howardpang / androidNativeBundle

a gradle plugin that support publish c/c++ headers to 'aar' and depend those 'aar'
Apache License 2.0
71 stars 14 forks source link

NDK warning: non-system libraries in linker flags #2

Open paulo-raca opened 4 years ago

paulo-raca commented 4 years ago

Thank you for this great plugin. It took me a while to find it, and I was even considering writing something like this myself.

This works perfectly, but I get some compilation warnings (Using NDK 21)

Android NDK: WARNING:xxxxx/Android.mk:libB: non-system libraries in linker flags: ~/.gradle/caches/transforms-2/files-2.1/37115bd2f005b93c0ccd8b241f03f93f/jetified-a-1.0.0-SNAPSHOT/jni/x86/libA.so    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    

I also get extra warnings when using it from a static library (In this case I just needed the headers):

WARNING:xxxxx/Android.mk:libC: LOCAL_LDFLAGS is always ignored for static libraries  

I attempted to fix it, but NDK's documentation suggests an approach different from what you are using: using PREBUILT_SHARED_LIBRARY and PREBUILT_STATIC_LIBRARY to declare dependencies -- Any thoughts?