| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- import org.apache.tools.ant.taskdefs.condition.Os
- apply plugin: 'com.android.application'
- RES_PATH = RES_PATH.replace("\\", "/")
- COCOS_ENGINE_PATH = COCOS_ENGINE_PATH.replace("\\", "/")
- buildDir = "${RES_PATH}/proj/build/$project.name"
- android {
- compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
- buildToolsVersion PROP_BUILD_TOOLS_VERSION
- ndkPath PROP_NDK_PATH
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- defaultConfig {
- // applicationId APPLICATION_ID
- applicationId "${PACKAGE_NAME}"
- minSdkVersion PROP_MIN_SDK_VERSION
- targetSdkVersion PROP_TARGET_SDK_VERSION
- multiDexEnabled true
- versionCode "${VERSION_CODE}".toInteger()
- versionName "${VERSION_NAME}"
- externalNativeBuild {
- cmake {
- targets "cocos"
- arguments "-DRES_DIR=${RES_PATH}", "-DCOCOS_X_PATH=${COCOS_ENGINE_PATH}", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", "-DANDROID_LD=gold"
- cppFlags "-frtti -fexceptions -fsigned-char"
- }
- ndk { abiFilters PROP_APP_ABI.split(':') }
- }
- }
- sourceSets.main {
- java.srcDirs "../src", "src"
- res.srcDirs "../res", 'res'
- jniLibs.srcDirs "../libs", 'libs'
- manifest.srcFile "AndroidManifest.xml"
- assets.srcDir "assets"
- jniLibs {
- // Vulkan validation layer
- // srcDir "${android.ndkDirectory}/sources/third_party/vulkan/src/build-android/jniLibs"
- }
- }
- externalNativeBuild {
- cmake {
- path "../CMakeLists.txt"
- buildStagingDirectory "${RES_PATH}/proj/build"
- }
- }
- signingConfigs {
- release {
- if (project.hasProperty("RELEASE_STORE_FILE") && !RELEASE_STORE_FILE.isEmpty()) {
- storeFile file(RELEASE_STORE_FILE)
- storePassword RELEASE_STORE_PASSWORD
- keyAlias RELEASE_KEY_ALIAS
- keyPassword RELEASE_KEY_PASSWORD
- }
- }
- }
- buildTypes {
- release {
- debuggable false
- jniDebuggable false
- renderscriptDebuggable false
- if (project.hasProperty("RELEASE_STORE_FILE")) {
- signingConfig signingConfigs.release
- }
- /**
- * 配置BuildConfig自动获取字段
- */
- buildConfigField "String", "TF_CHANNEL", "${TF_CHANNEL}"
- buildConfigField "String", "JL_AID", "${JL_AID}"
- buildConfigField "String", "JL_CHANNEL", "${JL_CHANNEL}"
- buildConfigField "String", "KS_AID", "${KS_AID}"
- buildConfigField "String", "KS_ANAME", "${KS_ANAME}"
- buildConfigField "String", "KS_CHANNEL", "${KS_CHANNEL}"
- buildConfigField "String", "UM_AID", "${UM_AID}"
- buildConfigField "String", "UM_CHANNEL", "${UM_CHANNEL}"
- buildConfigField "String", "UM_SECRET", "${UM_SECRET}"
- buildConfigField "String", "WX_APP_ID", "${WX_APP_ID}"
- buildConfigField "String", "TOPON", "${TOPON}"
- }
- debug {
- debuggable true
- jniDebuggable true
- renderscriptDebuggable true
- signingConfig signingConfigs.release
- buildConfigField "String", "TF_CHANNEL", "${TF_CHANNEL}"
- buildConfigField "String", "JL_AID", "${JL_AID}"
- buildConfigField "String", "JL_CHANNEL", "${JL_CHANNEL}"
- buildConfigField "String", "KS_AID", "${KS_AID}"
- buildConfigField "String", "KS_ANAME", "${KS_ANAME}"
- buildConfigField "String", "KS_CHANNEL", "${KS_CHANNEL}"
- buildConfigField "String", "UM_AID", "${UM_AID}"
- buildConfigField "String", "UM_CHANNEL", "${UM_CHANNEL}"
- buildConfigField "String", "UM_SECRET", "${UM_SECRET}"
- buildConfigField "String", "WX_APP_ID", "${WX_APP_ID}"
- buildConfigField "String", "TOPON", "${TOPON}"
- }
- }
- //CONFIG IN SERVER
- // applicationVariants.all { variant ->
- // variant.outputs.all {
- // variant.getPackageApplication().outputDirectory = new File("./release")
- // }
- // }
- }
- android.applicationVariants.all { variant ->
- def outputDir = "${projectDir}/assets"
- def sourceDir = "${RES_PATH}/assets"
- // assert file("${sourceDir}/res").exists()
- delete "${outputDir}"
- def targetName = variant.name.capitalize()
- def copyTaskName = "copy${targetName}ResourcesToAssets"
- tasks.register(copyTaskName) {
- copy {
- from sourceDir
- into outputDir
- }
- }
- tasks.getByName("pre${targetName}Build").dependsOn copyTaskName
- }
- dependencies {
- implementation fileTree(dir: '../libs', include: ['*.jar', '*.aar'])
- implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
- implementation fileTree(dir: "${COCOS_ENGINE_PATH}/cocos/platform/android/java/libs", include: ['*.jar'])
- implementation project(':libservice')
- implementation project(':libcocos')
- implementation "com.android.support:design:27.1.1"
- implementation 'com.android.support:multidex:1.0.3'
- implementation "com.android.support:support-v4:27.1.1"
- implementation "com.android.support:appcompat-v7:27.1.1"
- implementation "com.android.support:recyclerview-v7:27.1.1"
- implementation "com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+"
- implementation "com.github.bumptech.glide:glide:4.8.0"
- annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
- }
|