The error I get is:
error: undefined link to '__android_log_print'
I have already added this line to my .cpp file:
#include <android/log.h>
I tried with both: __ android_log_print and __ android_log_write
I also contacted the logging library in my Android.mk file (which I manually compile).
LOCAL_LDLIBS: = -llog
I also tried several alternatives that I found:
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
Here is my Android.mk:
LOCAL_PATH := $(call my-dir)
And here is the build.gradle file:
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.0.0+' } } apply plugin: 'android' dependencies { compile fileTree(dir: 'libs', include: '*.jar') } android { compileSdkVersion 21 buildToolsVersion "21.1.2" defaultConfig { ndk { moduleName "armapi" ldLibs "log" } } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' jniLibs.srcDir 'libs' // use the jni .so compiled from the manual ndk-build command jni.srcDirs = [] //disable automatic ndk-build call java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/<type> // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } }
android-studio android-gradle android-ndk jni
Stephen H. Anderson
source share