0

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'
iHowell
  • 2,263
  • 1
  • 25
  • 49
  • rather than track that down have you considered just updating to the new ndk integration with the current gradle android plugin with AndroidStudio 2.2? – Fred Grott Jul 20 '16 at 19:05
  • Not until now, but I may just have to do that. – iHowell Jul 20 '16 at 19:09
  • So I tried to do this with the current gradle plugin, but it told me to switch to experimental because NDK compilation was deprecated. – iHowell Jul 26 '16 at 14:53

0 Answers0