Android project - include static library


#1

I am building an API for Android that uses FFTw. After cross compiling FFTw for android

( http://blog.jimjh.com/compiling-open-source-libraries-with-android-ndk-part-2.html ) 

I was able to get it to work eventually by modifying the Android.mk file to include the prebuilt static library (my changes in bold):


LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := fftw3f
LOCAL_SRC_FILES := fftw/libfftw3f.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := juce_jni
... other stuff added automatically
...
...

LOCAL_STATIC_LIBRARIES := fftw3f
$(BUILD_SHARED_LIBRARY)


 

I tried using a local Android.mk file around the static library and C-style includes ( -lfftw3f ) in the introjucer project, but the compiler yelled at me and hurt my feelings. So, now I have a modified Android.mk file that I have to manage with version control so that I can start working on the iOS build and save my introjucer project. 

Is there some way to setup my introjucer project so I can include this library and still save my project without it being automatically overwritten?


#2

There's nothing in the introjucer that would let you add all that custom stuff, but if you want to suggest any simple changes that would extend it to do what you need, I'd be happy to take a look.


#3

I need this too.  Just added some very similar stuff to my Android.mk to get it to compile with ant. 

Specifically: 

​
LOCAL_PATH := $(call my-dir)

# -----------------------------------
#  Aubio library (prebuilt)
# -----------------------------------
include $(CLEAR_VARS)
LOCAL_MODULE := aubio
LOCAL_SRC_FILES := ../../../aubio-android/usr/local/lib/libaubio.a

include $(PREBUILT_STATIC_LIBRARY)

//.... auto generated stuff (source files)


# Add static libraries
LOCAL_STATIC_LIBRARIES := aubio

//.... auto generated stuff (compile flags etc)



Would it be possible to have a section in Introjucer for static libraries?

It might only need the file path, as it could infer the library name from the filename. 

Or an alternative way would be to have commented sections as there are in the generated cpp and .h files which are maintained when the project is saved. 

Would be good to have a way of altering the generated the main Activity class in this way too. 

 

 

 

 

 

 


#4

Unlikely I'll have time to research this myself right now, but if you could suggest a change to the introjucer that works for you, I can sanity-check it..


#5

Yes I was going to take a look, will let you know, thanks