How to configure build-settings for using external static library in Introjucer?


#1

Hi

Just like the title said. For example, I have a external static library "abc.a" for JUCE project. It isn't a Android native library. In order to link this static library and compile the project successfully, I copy the library into "../Builds/Android/jni/", and modify the file "Android.mk":

After line 4, add:

include $(CLEAR_VARS)
LOCAL_MODULE := abc
LOCAL_SRC_FILES := abc.a
include $(PREBUILT_STATIC_LIBRARY)

Before the last line, add:

LOCAL_STATIC_LIBRARIES := abc

By this way, it works fine. The problem is, whenever I save the project in Introjucer, I'll have to modify the file "Android.mk" once more. I think perhaps Introjucer's build-settings of Android project also could do this and generates the above code automatically. 

Unfortunately, I can't firgure out which property I should to fill in and what the correct value must be set to. After tried many, many times, I still have no any luck.

Could anyone give me some clues or prompts?

Thanks in advance.


#2

Hi loopfine,

You should already be able to do this via the "Import static library modules" field in the Introjucer. You can find this field after clicking on the Android target (and scrolling down a bit on the RHS). Does this work for you?

Fabian


#3

Thanks Fabian.
I had found the “Import static library modules” and tried many values to fill in, but it just can’t compile…


#4

What sorts of errors are you getting?


#5
-pre-build:

     [exec] Android NDK: jni/Android.mk: Cannot find module with tag 'abc.a' in import path
     [exec] Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
     [exec] Android NDK: The following directories were searched:
     [exec] Android NDK:
     [exec] jni/Android.mk:69: *** Android NDK: Aborting.    .  Stop.

No matter what value(s) I set in 'Import static library module', it always asks me that value cannot be found in import path. Certainly, I'm sure my NDK_MODULE_PATH hasn't been defineded... I just don't know where and how to set these things correctly in Introjucer...

//==============================================

Other stupid complains:

It also a troublesome thing for JUCE project on other platforms (do some build-settings in Introjucer) when you want to use 3rd static library or something else. I've looked into all the C++ books I have (more than 15 books) and searched JUCE source code again and again, can't find any helpful information. Such as "Extra processor define", "Extra xxx flags", "Preprocessor define", "Pre/post build command", and so on... What on earth are these things for?? 

I think those must related to various OSes, IDEs or compilers. After some searches and studies, it's nearly driven me mad... Many of these defines or symbols don't even can be found in English dictionray. I'm sure Introjucer is making those things more easily, and there are bridf explanations for each of them, but for me, it seems more difficult to understand and more confusing...


#6

The introjucer will only include the "LOCAL_STATIC_LIBRARIES := abc" line that you added to your Android.mk. This change works for me. So you think you need to figure out why you need the other four lines.


#7

After many, many tries once more, still have no any luck...

Finnally, I made a 'best' decision: modified the Introjucer's source file, added some hard code...

Now, everything is peace and quiet...

THANKS!!!