Error I\'m getting:
error: undefined reference to \'__android_log_print\'
I\'ve already added this line to my .cpp file:
I use Gradle 2.5 with Android Studio 1.4.1 and it works for me with this syntax:
ldLibs += "log"
The model build.gradle should be something similar:
apply plugin: 'com.android.model.application' model{ android { compileSdkVersion = 23 buildToolsVersion = "23.0.1" defaultConfig.with { applicationId = "com.local.some.project" minSdkVersion.apiLevel = 17 targetSdkVersion.apiLevel = 23 versionCode = 1 versionName = "1.0" } } android.buildTypes { release { minifyEnabled = false proguardFiles += file('proguard-rules.pro') } } android.ndk { moduleName = "MyModel" ldLibs += "log" } compileOptions.with { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:23.0.1' compile files('libs/some3rdParty.jar') }
ADD this in Your android.mk file
LOCAL_LDLIBS := -llog -ljnigraphics
It seems that using Gradle + Android Studio the Android.mk file is ignored.
As explained here, try adding the following directive to your build.gradle:
android {
defaultConfig {
ndk {
moduleName "modulename"
ldLibs "log"
}
}
}