undefined reference to __android_log_print

android, android-ndk

Solution

In your code, the second line overrides the first. If you really need -landroid, use

LOCAL_LDLIB +=-landroid

Most likely, the `-L$(SYSROOT)/usr/lib` part should be omitted.

Problem

This question exists, but it was unable to fix my problem. I'm getting an undefined reference to __android_log_print but I have the include header `#include <android/log.h>` and my Android.mk file has `LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog` `LOCAL_LDLIBS := -landroid` I've also tried with just the -llog, to no avail.

Original source