Deadlock
Deadlock

Reputation: 819

Compile native C code with android libraries

I have a native C code to android (I'm not using JNI, it's pure C) and I want to print log messages on LogCat. Without using #include<android/log.h> I was able to compile with arm-linux-gnueabi-gcc -static -o Matrix MatrixMultiplication.c and it worked very well, but now i need to send to LogCat some messages with #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG , "NativeC", __VA_ARGS__). I tried to import the library but it didn't work and this: http://betelco.blogspot.com.br/2010/01/buildingdebugging-android-native-c.html . I'm using android-ndk-r8b

How can i do this?

thanks

Upvotes: 0

Views: 443

Answers (1)

Chris Stratton
Chris Stratton

Reputation: 40337

For better compatibility with Android features, instead of directly invoking the compiler and linker, you should use the same structure as for a jni project, but use

include $(BUILD_EXECUTABLE)

in the Android.mk instead of one of the library build choices.

Be aware that building and invoking executable is not officially supported, though it works at present.

Upvotes: 1

Related Questions