0

我最近.mk在 gradle-experimental 插件的帮助下,从在我的 android-ndk 项目中使用文件切换到使用完全 gradle 解决方案。完成此操作后,我认为它可以正常工作,但随后我清理了项目并手动删除了所有.so文件,以便可以重新创建它们。不幸的是,在此之后,它们再也没有被重新创建。出于某种原因,我的本机源代码没有被编译。我的 gradle 出了什么问题(我认为它必须如此)。

项目结构:

android/
    app/
        build/
        src/
            main/
                assets/
                java/
                res/
                AndroidManifest.xml
        build.gradle
    build.gradle
    settings.gradle
    local.properties
common/
    src/
    headers/
    freetype/
    ...
ios/

应用程序: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'
4

0 回答 0