2015-05-15 16:37:43 +08:00
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
|
|
|
|
android {
|
|
|
|
compileSdkVersion 22
|
|
|
|
buildToolsVersion "22.0.1"
|
|
|
|
|
|
|
|
defaultConfig {
|
2015-05-21 18:27:30 +08:00
|
|
|
applicationId "org.cocos2dx.hellojavascript"
|
2015-05-15 16:37:43 +08:00
|
|
|
minSdkVersion 10
|
|
|
|
targetSdkVersion 22
|
|
|
|
versionCode 1
|
|
|
|
versionName "1.0"
|
2017-02-21 17:58:30 +08:00
|
|
|
|
|
|
|
externalNativeBuild {
|
|
|
|
ndkBuild {
|
|
|
|
targets 'cocos2djs'
|
|
|
|
arguments 'NDK_MODULE_PATH=../../../cocos2d-x:../../../cocos2d-x/cocos:../../../cocos2d-x/external'
|
|
|
|
arguments '-j' + Runtime.runtime.availableProcessors()
|
|
|
|
abiFilters 'armeabi'
|
|
|
|
}
|
|
|
|
}
|
2015-05-15 16:37:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets.main {
|
|
|
|
java.srcDir "src"
|
|
|
|
res.srcDir "res"
|
2015-05-18 13:41:58 +08:00
|
|
|
jniLibs.srcDir "libs"
|
2015-05-15 16:37:43 +08:00
|
|
|
manifest.srcFile "AndroidManifest.xml"
|
|
|
|
assets.srcDir "assets"
|
|
|
|
}
|
|
|
|
|
2017-02-21 17:58:30 +08:00
|
|
|
externalNativeBuild {
|
|
|
|
ndkBuild {
|
|
|
|
path "jni/Android.mk"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-22 15:52:41 +08:00
|
|
|
signingConfigs {
|
|
|
|
|
|
|
|
release {
|
|
|
|
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
|
|
|
storeFile file(RELEASE_STORE_FILE)
|
|
|
|
storePassword RELEASE_STORE_PASSWORD
|
|
|
|
keyAlias RELEASE_KEY_ALIAS
|
|
|
|
keyPassword RELEASE_KEY_PASSWORD
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-15 16:37:43 +08:00
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
minifyEnabled false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
2015-05-22 15:52:41 +08:00
|
|
|
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
|
|
|
signingConfig signingConfigs.release
|
|
|
|
}
|
2015-05-15 16:37:43 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-21 17:58:30 +08:00
|
|
|
android.applicationVariants.all { variant ->
|
|
|
|
def copyAssets = task("${variant.dirName}copyAssets", type: Copy) {
|
2015-12-22 14:56:21 +08:00
|
|
|
|
2017-02-21 17:58:30 +08:00
|
|
|
// delete previous files first
|
|
|
|
delete "${buildDir}/intermediates/assets/${variant.dirName}"
|
2015-12-22 14:56:21 +08:00
|
|
|
|
2017-02-21 17:58:30 +08:00
|
|
|
copy {
|
|
|
|
from "${buildDir}/../../../../../res"
|
|
|
|
into "${buildDir}/intermediates/assets/${variant.dirName}/res"
|
|
|
|
}
|
|
|
|
|
|
|
|
copy {
|
|
|
|
from "${buildDir}/../../../../../src"
|
|
|
|
into "${buildDir}/intermediates/assets/${variant.dirName}/src"
|
|
|
|
}
|
|
|
|
|
|
|
|
copy {
|
|
|
|
from "${buildDir}/../../../../cocos2d-x/cocos/scripting/js-bindings/script"
|
|
|
|
into "${buildDir}/intermediates/assets/${variant.dirName}/script"
|
|
|
|
}
|
|
|
|
|
|
|
|
copy {
|
|
|
|
from "${buildDir}/../../../../../main.js"
|
|
|
|
from "${buildDir}/../../../../../project.json"
|
|
|
|
into "${buildDir}/intermediates/assets/${variant.dirName}"
|
|
|
|
}
|
2015-12-22 14:56:21 +08:00
|
|
|
}
|
2017-02-21 17:58:30 +08:00
|
|
|
|
|
|
|
variant.mergeAssets.finalizedBy copyAssets
|
2015-12-22 14:56:21 +08:00
|
|
|
}
|
|
|
|
|
2017-02-21 17:58:30 +08:00
|
|
|
dependencies {
|
|
|
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
|
|
|
compile project(':libcocos2dx')
|
|
|
|
}
|