使用gradle-experimental插件的android-studio中基于cocos2dx的项目 [英] cocos2dx-based project in android-studio using gradle-experimental plugin

查看:248
本文介绍了使用gradle-experimental插件的android-studio中基于cocos2dx的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个符合gradle实验0.6.0-alpha1的build.gradle文件:

apply plugin: 'com.android.model.application'

model {
    android {
        compileSdkVersion = 21
        buildToolsVersion = "23.0.2"

        defaultConfig.with {
            applicationId = "com.company.application"
            minSdkVersion.apiLevel = 21
            targetSdkVersion.apiLevel = 21
        }
    }
    android.buildTypes {
        release {
            minifyEnabled = false
            proguardFiles.add(file('proguard-rules.pro'))
        }
    }

    android.ndk {
        moduleName = "moduleName"
    }
}

dependencies {
    compile project(':libcocos2dx')
}

我正在使用cocos2dx作为引擎.我有一个看起来像这样的文件夹层次结构:

  • 类(包含我项目的所有C ++代码)
  • proj.android/src/main/projectName/jni(其中包含供cocos2d挂接的main.cpp文件)

我还有许多其他cpp类,它们位于proj.android之外的其他文件夹中(例如,cocos2d cpp文件位于proj.android/../../../dependencies/XXXX/cocos2d- x和引擎文件位于proj.android/../../../dependencies/XXXX/engine,我所有的C ++代码都位于proj.android/../Classes,就像在每个cocos2dx项目中一样)

我正在尝试使用最新的gradle实验性插件(gradle-experimental-0.6.0-alpha1)构建我的应用程序.

我首先尝试按原样构建它,进行项目编译并运行,但是它是空的(没有生成libMyApp.so),因为我没有在gradle构建中包括任何C ++源文件.

然后我做了一些到源文件文件夹的符号链接,以便gradle可以选择它们:

ln -s proj.android/../../../dependencies/XXXX/cocos2d-x proj.android/src/main/projectName/jni

现在,当我构建(./gradlew assembleDebug)时,我得到它编译符号链接的C ++文件,但是无论我如何尝试,它每次都会在头文件的第一个include中失败.

我已尝试按这里使用:

android.sources {
        main {
            jni {
                source {
                    srcDir "src"
                }
                exportedHeaders {
                    srcDir "src"
                }
            }
        }
    }

但是我无法找到丢失的".h"标题.如果有人尝试使用cocos2Dx,gradle-experimental和android-studio构建后续的C ++项目,请随时分享任何经验.当我能够编译它时,我将尝试编译某种指南(一天:))

供参考:最新的gradle文档:

https://docs.gradle.org/2.9/userguide/nativeBinaries.html

usefull链接:

http://ph0b.com/new-android-studio-ndk-支持/

解决方案

谢谢您的文件,我对您的文件做了一些修改.

然后我工作了,我在Mac OSX上使用cocos2Dx 3.9做到了.

您需要:com.android.tools.build:gradle-experimental:0.6.0-alpha5'

您可以同时在Java和C ++中放置断点.

Cyrl

import org.apache.tools.ant.taskdefs.condition.Os

apply plugin: 'com.android.model.library'

model {

    repositories {
        libs(PrebuiltLibraries) {
            chipmunk {
                headers.srcDir "../../../../external/chipmunk/include"
                binaries.withType(SharedLibraryBinary) {
                    //
                    // NOTE: this block should be "StaticLibraryBinary"/staticLibraryFile - but SharedLibraryBinary works and StaticLibraryBinary doesn't as of 0.6.0-alpha2
                    // bug reported here: https://code.google.com/p/android/issues/detail?id=196065
                    //
                    sharedLibraryFile = file("../../../../external/chipmunk/prebuilt/android/${targetPlatform.getName()}/libchipmunk.a")
                }
            }
            freetype2 {
                headers.srcDir "../../../../external/freetype2/include/android/freetype2"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/freetype2/prebuilt/android/${targetPlatform.getName()}/libfreetype.a")
                }
            }
            curl {
                headers.srcDir "../../../../external/curl/include/android/curl"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/curl/prebuilt/android/${targetPlatform.getName()}/libcurl.a")
                }
            }
            png {
                headers.srcDir "../../../../external/png/include/android"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/png/prebuilt/android/${targetPlatform.getName()}/libpng.a")
                }
            }
            jpeg {
                headers.srcDir "../../../../external/jpeg/include/android"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/jpeg/prebuilt/android/${targetPlatform.getName()}/libjpeg.a")
                }
            }
            tiff {
                headers.srcDir "../../../../external/tiff/include/android"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/tiff/prebuilt/android/${targetPlatform.getName()}/libtiff.a")
                }
            }
            webp {
                headers.srcDir "../../../../external/webp/include/android"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/webp/prebuilt/android/${targetPlatform.getName()}/libwebp.a")
                }
            }
            bullet {
                headers.srcDir "../../../../external/bullet/"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/bullet/obj/local/${targetPlatform.getName()}/libbullet.a")
                }
            }
            recast {
                headers.srcDir "../../../../external/recast/"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/recast/obj/local/${targetPlatform.getName()}/librecast.a")
                }
            }
            websockets {
                headers.srcDir "../../../../external/websockets/include/android"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/websockets/prebuilt/android/${targetPlatform.getName()}/libwebsockets.a")
                }
            }
            ssl {
                headers.srcDir "../../../../external/curl/include/android/curl"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/curl/prebuilt/android/${targetPlatform.getName()}/libssl.a")
                }
            }
            crypto {
                headers.srcDir "../../../../external/curl/include/android/curl"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/curl/prebuilt/android/${targetPlatform.getName()}/libcrypto.a")
                }
            }
        }
    }

    android {
        compileSdkVersion = 21
        buildToolsVersion = "23.0.2"

        defaultConfig.with {
            minSdkVersion.apiLevel = 9
            targetSdkVersion.apiLevel = 9
        }
    }

    android.ndk {
        moduleName = "cocos2dx"
        stl = "c++_static"
        cppFlags.add("-std=c++11")
        cppFlags.add("-pthread")
        cppFlags.add("-fexceptions")
        cppFlags.add("-frtti")

        CFlags.add("-DUSE_FILE32API")
        CFlags.add("-fexceptions")

        ldLibs.addAll(["atomic", "log", "android", "EGL", "GLESv2", "z"  ])
    }

    android.sources {
        main {
            manifest.source {
                srcDir "."
                include "AndroidManifest.xml"
            }

            jni {
                source {
                    // INTERNAL CPP FILES
                    //srcDir "../../../../cocos/"
                    // include only file at this level
                    srcDir "../../../../cocos/2d"
                    srcDir "../../../../cocos/sourceFile"
                    srcDir "../../../../cocos/3d"
                    srcDir "../../../../cocos/math"
                    srcDir "../../../../cocos/base"
                    srcDir "../../../../cocos/platform/sourceFiles"
                    srcDir "../../../../cocos/cpufeatures"
                    // include only file at this level
                    srcDir "../../../../cocos/platform/android"
                    srcDir "../../../../cocos/renderer"
                    srcDir "../../../../cocos/deprecated"
                    srcDir "../../../../cocos/physics"
                    srcDir "../../../../cocos/physics3d"
                    srcDir "../../../../cocos/navmesh"
                    srcDir "../../../../cocos/network"
                    srcDir "../../../../tests/cpp-empty-test/Classes"
                    srcDir "../../../../tests/cpp-empty-test/Main"

                    // EXTERNAL CPP FILES
                    srcDir "../../../../external/ConvertUTF"
                    srcDir "../../../../external/tinyxml2"
                    srcDir "../../../../external/unzip"
                    srcDir "../../../../external/edtaa3func"
                    srcDir "../../../../external/poly2tri"
                    srcDir "../../../../external/clipper"
                    srcDir "../../../../external/xxhash"
                }

                exportedHeaders {
                    // INTERNAL HEADERS
                    srcDir "../../../../cocos"
                    srcDir "../../../../cocos/2d"
                    srcDir "../../../../cocos/math"
                    srcDir "../../../../cocos/base"
                    srcDir "../../../../cocos/platform"
                    srcDir "../../../../cocos/platform/android"
                    srcDir "../../../../cocos/renderer"
                    srcDir "../../../../cocos/deprecated"
                    srcDir "../../../../cocos/physics"
                    srcDir "../../../../cocos/physics3d"
                    srcDir "../../../../cocos/navmesh"
                    srcDir "../../../../tests/cpp-empty-test/Classes"


                    // EXTERNAL HEADERS
                    srcDir "../../../../external"
                    srcDir "../../../../external/ConvertUTF"
                    srcDir "../../../../external/tinyxml2"
                    srcDir "../../../../external/unzip"
                    srcDir "../../../../external/edtaa3func"
                    srcDir "../../../../external/poly2tri"
                    srcDir "../../../../external/poly2tri/common"
                    srcDir "../../../../external/poly2tre/sweep"
                    srcDir "../../../../external/clipper"
                    srcDir "../../../../external/xxhash"


                    // STATIC LIBRARIES
                    srcDir "../../../../external/chipmunk/include/chipmunk"
                    srcDir "../../../../external/freetype2/include/android/freetype2"
                    srcDir "../../../../external/curl/include/android"
                    srcDir "../../../../external/png/include/android"
                    srcDir "../../../../external/tiff/include/android"
                    srcDir "../../../../external/jpeg/include/android"
                    srcDir "../../../../external/webp/include/android"
                    srcDir "../../../../external/websockets/include/android"
                }

                dependencies {
                    library "chipmunk"
                    library "freetype2"
                    library "curl"
                    library "png"
                    library "jpeg"
                    library "tiff"
                    library "webp"
                    library "bullet"
                    library "recast"
                    library "websockets"
                    library "ssl"
                    library "crypto"
                }
            }
        }
    }

    android.buildTypes {
        release {

        }
        debug {
            ndk.with {
                debuggable = true
            }
        }
    }

    android.productFlavors {
        create ("arm") {
            ndk.with {
                abiFilters.add("armeabi-v7a")
                ldFlags.addAll([
                        "-L${file("./obj/local/armeabi-v7a")}".toString()
                ])
            }
        }
        create("x86") {
            ndk.with {
                abiFilters.add("x86")
                ldFlags.addAll([
                        "-L${file("./obj/local/x86")}".toString()
                ])
            }
        }
    }
}

task buildMkRecast(type: Exec) {
    // Retrieve ndk dir
    Properties properties = new Properties()
    properties.load(project.rootProject.file('local.properties').newDataInputStream())
    def ndkDir = properties.getProperty('ndk.dir', null)

    // Call ndk build
    def ndkBuildExt = Os.isFamily(Os.FAMILY_WINDOWS) ? ".cmd" : ""
    commandLine "$ndkDir/ndk-build${ndkBuildExt}",
            '-C', file('.').absolutePath,
            'NDK_APPLICATION_MK=Application.mk',
            'APP_BUILD_SCRIPT=../../../../external/recast/Android.mk',
            'NDK_PROJECT_PATH=../../../../external/recast/'
}

task buildMkBullet(dependsOn: "buildMkRecast",type: Exec) {
    // Retrieve ndk dir
    Properties properties = new Properties()
    properties.load(project.rootProject.file('local.properties').newDataInputStream())
    def ndkDir = properties.getProperty('ndk.dir', null)

    // Call ndk build
    def ndkBuildExt = Os.isFamily(Os.FAMILY_WINDOWS) ? ".cmd" : ""
    commandLine "$ndkDir/ndk-build${ndkBuildExt}",
            '-C', file('.').absolutePath,
            'NDK_APPLICATION_MK=Application.mk',
            'APP_BUILD_SCRIPT=../../../../external/bullet/Android.mk',
            'NDK_PROJECT_PATH=../../../../external/bullet/'
}

tasks.whenTaskAdded { task ->
    def taskName = task.name

    if (taskName.startsWith("compile")) {
        task.dependsOn "buildMkBullet"
    }
}

dependencies {
    compile files('../java/libs/android-async-http-1.4.8.jar')
}

I have a gradle-experimental 0.6.0-alpha1 compliant build.gradle file:

apply plugin: 'com.android.model.application'

model {
    android {
        compileSdkVersion = 21
        buildToolsVersion = "23.0.2"

        defaultConfig.with {
            applicationId = "com.company.application"
            minSdkVersion.apiLevel = 21
            targetSdkVersion.apiLevel = 21
        }
    }
    android.buildTypes {
        release {
            minifyEnabled = false
            proguardFiles.add(file('proguard-rules.pro'))
        }
    }

    android.ndk {
        moduleName = "moduleName"
    }
}

dependencies {
    compile project(':libcocos2dx')
}

And I am using cocos2dx as my engine. I have a folder hierarchy that looks like this:

  • Classes (which contains all the C++ code of my project)
  • proj.android/src/main/projectName/jni (which contains the main.cpp file for cocos2d to hook on)

I also have many other cpp classes that are in a different folders outside the proj.android one (the cocos2d cpp file for example are at proj.android/../../../dependencies/XXXX/cocos2d-x and the engine files are at proj.android/../../../dependencies/XXXX/engine, and all my C++ code is at proj.android/../Classes, as in every cocos2dx project)

I am trying to build my application using the latest gradle experimental plugin (gradle-experimental-0.6.0-alpha1).

I first try to build it as-is, project compile and run but was empty (no libMyApp.so was generated), because I didn't included any C++ source file in my gradle build.

I then made some symbolic link to the source file folder so that gradle could pick them:

ln -s proj.android/../../../dependencies/XXXX/cocos2d-x proj.android/src/main/projectName/jni

Now when I am building (./gradlew assembleDebug), I get it compile symboliquely linked C++ files, but it fails on the first include of header everytime, no matter what I try.

I have tried to add source file/ header include as described here using:

android.sources {
        main {
            jni {
                source {
                    srcDir "src"
                }
                exportedHeaders {
                    srcDir "src"
                }
            }
        }
    }

but I couldn't get it to find the missing ".h" headers. If anybody has tried to build a consequent C++ project using cocos2Dx, gradle-experimental and android-studio please feel free to share any experience. I will try to compile some sort of guide when I will be able to compile it (one day :))

for reference: latest gradle doc:

https://docs.gradle.org/2.9/userguide/nativeBinaries.html

usefull link:

http://ph0b.com/new-android-studio-ndk-support/

解决方案

Hi Thank you for your file, I made some modification to you files.

I works then, I did it with cocos2Dx 3.9 on my Mac OSX.

You need : com.android.tools.build:gradle-experimental:0.6.0-alpha5'

You can put breakpoints in Java and C++ at the same time.

Cyrl

import org.apache.tools.ant.taskdefs.condition.Os

apply plugin: 'com.android.model.library'

model {

    repositories {
        libs(PrebuiltLibraries) {
            chipmunk {
                headers.srcDir "../../../../external/chipmunk/include"
                binaries.withType(SharedLibraryBinary) {
                    //
                    // NOTE: this block should be "StaticLibraryBinary"/staticLibraryFile - but SharedLibraryBinary works and StaticLibraryBinary doesn't as of 0.6.0-alpha2
                    // bug reported here: https://code.google.com/p/android/issues/detail?id=196065
                    //
                    sharedLibraryFile = file("../../../../external/chipmunk/prebuilt/android/${targetPlatform.getName()}/libchipmunk.a")
                }
            }
            freetype2 {
                headers.srcDir "../../../../external/freetype2/include/android/freetype2"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/freetype2/prebuilt/android/${targetPlatform.getName()}/libfreetype.a")
                }
            }
            curl {
                headers.srcDir "../../../../external/curl/include/android/curl"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/curl/prebuilt/android/${targetPlatform.getName()}/libcurl.a")
                }
            }
            png {
                headers.srcDir "../../../../external/png/include/android"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/png/prebuilt/android/${targetPlatform.getName()}/libpng.a")
                }
            }
            jpeg {
                headers.srcDir "../../../../external/jpeg/include/android"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/jpeg/prebuilt/android/${targetPlatform.getName()}/libjpeg.a")
                }
            }
            tiff {
                headers.srcDir "../../../../external/tiff/include/android"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/tiff/prebuilt/android/${targetPlatform.getName()}/libtiff.a")
                }
            }
            webp {
                headers.srcDir "../../../../external/webp/include/android"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/webp/prebuilt/android/${targetPlatform.getName()}/libwebp.a")
                }
            }
            bullet {
                headers.srcDir "../../../../external/bullet/"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/bullet/obj/local/${targetPlatform.getName()}/libbullet.a")
                }
            }
            recast {
                headers.srcDir "../../../../external/recast/"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/recast/obj/local/${targetPlatform.getName()}/librecast.a")
                }
            }
            websockets {
                headers.srcDir "../../../../external/websockets/include/android"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/websockets/prebuilt/android/${targetPlatform.getName()}/libwebsockets.a")
                }
            }
            ssl {
                headers.srcDir "../../../../external/curl/include/android/curl"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/curl/prebuilt/android/${targetPlatform.getName()}/libssl.a")
                }
            }
            crypto {
                headers.srcDir "../../../../external/curl/include/android/curl"
                binaries.withType(SharedLibraryBinary) {
                    sharedLibraryFile = file("../../../../external/curl/prebuilt/android/${targetPlatform.getName()}/libcrypto.a")
                }
            }
        }
    }

    android {
        compileSdkVersion = 21
        buildToolsVersion = "23.0.2"

        defaultConfig.with {
            minSdkVersion.apiLevel = 9
            targetSdkVersion.apiLevel = 9
        }
    }

    android.ndk {
        moduleName = "cocos2dx"
        stl = "c++_static"
        cppFlags.add("-std=c++11")
        cppFlags.add("-pthread")
        cppFlags.add("-fexceptions")
        cppFlags.add("-frtti")

        CFlags.add("-DUSE_FILE32API")
        CFlags.add("-fexceptions")

        ldLibs.addAll(["atomic", "log", "android", "EGL", "GLESv2", "z"  ])
    }

    android.sources {
        main {
            manifest.source {
                srcDir "."
                include "AndroidManifest.xml"
            }

            jni {
                source {
                    // INTERNAL CPP FILES
                    //srcDir "../../../../cocos/"
                    // include only file at this level
                    srcDir "../../../../cocos/2d"
                    srcDir "../../../../cocos/sourceFile"
                    srcDir "../../../../cocos/3d"
                    srcDir "../../../../cocos/math"
                    srcDir "../../../../cocos/base"
                    srcDir "../../../../cocos/platform/sourceFiles"
                    srcDir "../../../../cocos/cpufeatures"
                    // include only file at this level
                    srcDir "../../../../cocos/platform/android"
                    srcDir "../../../../cocos/renderer"
                    srcDir "../../../../cocos/deprecated"
                    srcDir "../../../../cocos/physics"
                    srcDir "../../../../cocos/physics3d"
                    srcDir "../../../../cocos/navmesh"
                    srcDir "../../../../cocos/network"
                    srcDir "../../../../tests/cpp-empty-test/Classes"
                    srcDir "../../../../tests/cpp-empty-test/Main"

                    // EXTERNAL CPP FILES
                    srcDir "../../../../external/ConvertUTF"
                    srcDir "../../../../external/tinyxml2"
                    srcDir "../../../../external/unzip"
                    srcDir "../../../../external/edtaa3func"
                    srcDir "../../../../external/poly2tri"
                    srcDir "../../../../external/clipper"
                    srcDir "../../../../external/xxhash"
                }

                exportedHeaders {
                    // INTERNAL HEADERS
                    srcDir "../../../../cocos"
                    srcDir "../../../../cocos/2d"
                    srcDir "../../../../cocos/math"
                    srcDir "../../../../cocos/base"
                    srcDir "../../../../cocos/platform"
                    srcDir "../../../../cocos/platform/android"
                    srcDir "../../../../cocos/renderer"
                    srcDir "../../../../cocos/deprecated"
                    srcDir "../../../../cocos/physics"
                    srcDir "../../../../cocos/physics3d"
                    srcDir "../../../../cocos/navmesh"
                    srcDir "../../../../tests/cpp-empty-test/Classes"


                    // EXTERNAL HEADERS
                    srcDir "../../../../external"
                    srcDir "../../../../external/ConvertUTF"
                    srcDir "../../../../external/tinyxml2"
                    srcDir "../../../../external/unzip"
                    srcDir "../../../../external/edtaa3func"
                    srcDir "../../../../external/poly2tri"
                    srcDir "../../../../external/poly2tri/common"
                    srcDir "../../../../external/poly2tre/sweep"
                    srcDir "../../../../external/clipper"
                    srcDir "../../../../external/xxhash"


                    // STATIC LIBRARIES
                    srcDir "../../../../external/chipmunk/include/chipmunk"
                    srcDir "../../../../external/freetype2/include/android/freetype2"
                    srcDir "../../../../external/curl/include/android"
                    srcDir "../../../../external/png/include/android"
                    srcDir "../../../../external/tiff/include/android"
                    srcDir "../../../../external/jpeg/include/android"
                    srcDir "../../../../external/webp/include/android"
                    srcDir "../../../../external/websockets/include/android"
                }

                dependencies {
                    library "chipmunk"
                    library "freetype2"
                    library "curl"
                    library "png"
                    library "jpeg"
                    library "tiff"
                    library "webp"
                    library "bullet"
                    library "recast"
                    library "websockets"
                    library "ssl"
                    library "crypto"
                }
            }
        }
    }

    android.buildTypes {
        release {

        }
        debug {
            ndk.with {
                debuggable = true
            }
        }
    }

    android.productFlavors {
        create ("arm") {
            ndk.with {
                abiFilters.add("armeabi-v7a")
                ldFlags.addAll([
                        "-L${file("./obj/local/armeabi-v7a")}".toString()
                ])
            }
        }
        create("x86") {
            ndk.with {
                abiFilters.add("x86")
                ldFlags.addAll([
                        "-L${file("./obj/local/x86")}".toString()
                ])
            }
        }
    }
}

task buildMkRecast(type: Exec) {
    // Retrieve ndk dir
    Properties properties = new Properties()
    properties.load(project.rootProject.file('local.properties').newDataInputStream())
    def ndkDir = properties.getProperty('ndk.dir', null)

    // Call ndk build
    def ndkBuildExt = Os.isFamily(Os.FAMILY_WINDOWS) ? ".cmd" : ""
    commandLine "$ndkDir/ndk-build${ndkBuildExt}",
            '-C', file('.').absolutePath,
            'NDK_APPLICATION_MK=Application.mk',
            'APP_BUILD_SCRIPT=../../../../external/recast/Android.mk',
            'NDK_PROJECT_PATH=../../../../external/recast/'
}

task buildMkBullet(dependsOn: "buildMkRecast",type: Exec) {
    // Retrieve ndk dir
    Properties properties = new Properties()
    properties.load(project.rootProject.file('local.properties').newDataInputStream())
    def ndkDir = properties.getProperty('ndk.dir', null)

    // Call ndk build
    def ndkBuildExt = Os.isFamily(Os.FAMILY_WINDOWS) ? ".cmd" : ""
    commandLine "$ndkDir/ndk-build${ndkBuildExt}",
            '-C', file('.').absolutePath,
            'NDK_APPLICATION_MK=Application.mk',
            'APP_BUILD_SCRIPT=../../../../external/bullet/Android.mk',
            'NDK_PROJECT_PATH=../../../../external/bullet/'
}

tasks.whenTaskAdded { task ->
    def taskName = task.name

    if (taskName.startsWith("compile")) {
        task.dependsOn "buildMkBullet"
    }
}

dependencies {
    compile files('../java/libs/android-async-http-1.4.8.jar')
}

这篇关于使用gradle-experimental插件的android-studio中基于cocos2dx的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆