I recently switched from using .mk
files in my android-ndk project to using a fully gradle solution, with the help of the gradle-experimental plugin. After I did this, I thought it was working, but then I cleaned the project and manually deleted all the .so
files so that they could be recreated. Unfortunately, after this they were never recreated. For some reason my native source isn't being compiled. What is wrong with my gradle (which I assume it has to be).
Project Structure:
android/
app/
build/
src/
main/
assets/
java/
res/
AndroidManifest.xml
build.gradle
build.gradle
settings.gradle
local.properties
common/
src/
headers/
freetype/
...
ios/
app: build.gradle:
apply plugin: 'com.android.model.application'
apply plugin: 'checkstyle'
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile 'com.android.support:support-v4:23.3.0'
}
model {
android {
compileSdkVersion = 23
buildToolsVersion = '23.0.2'
dependencies {
}
defaultConfig.with {
applicationId = 'com.buildertrend.gantt'
minSdkVersion.apiLevel = 11
targetSdkVersion.apiLevel = 23
buildConfigFields {
create() {
type "int"
name "VALUE"
value "1"
}
}
}
buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file('proguard-rules.txt'))
}
}
ndk {
moduleName "gantt"
stl "stlport_static"
CFlags.add("-I../../common/freetype/include")
CFlags.add("-DANDROID_NDK")
CFlags.add("-DDISABLE_IMPORTGL")
CFlags.add("-DFT2_BUILD_LIBRARY=1")
ldLibs.add("EGL")
ldLibs.add("android")
ldLibs.add("GLESv2")
ldLibs.add("dl")
ldLibs.add("log")
ldLibs.add("mui")
}
sources {
main {
jniLibs{
source{
srcDir 'src/main/libs'
}
}
java {
source {
srcDirs = ["src/main/java"]
}
}
jni {
exportedHeaders {
srcDirs = ["../../common/freetype/include"]
}
source {
srcDirs = ["../../common/src"]
srcDirs += ["../../common/headers"]
include "../../common/freetype/src/autofit/autofit.c"
include "../../common/freetype/src/base/basepic.c"
...
}
}
}
}
}
}
checkstyle {
toolVersion = '6.18'
configFile rootProject.file('checkstyle.xml')
showViolations true
configProperties = ['checkstyle.cache.file': rootProject.file('build/checkstyle.cache')]
}
task checkstyle(type: Checkstyle) {
source 'src'
include '**/java/com/buildertrend/gantt/**/*.java'
// empty classpath
classpath = files()
}
check.dependsOn 'checkstyle'