| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- apply plugin: 'com.android.application'
- RES_PATH = RES_PATH.replace("\\", "/")
- COCOS_ENGINE_PATH = COCOS_ENGINE_PATH.replace("\\", "/")
- buildDir = "${RES_PATH}/proj/build/${project.name ==~ /^[_a-zA-Z0-9-]+$/ ? project.name : 'CocosGame'}"
- android {
- compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
- buildToolsVersion PROP_BUILD_TOOLS_VERSION
- ndkPath PROP_NDK_PATH
- namespace NAME_SPACE
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- defaultConfig {
- applicationId APPLICATION_ID
- minSdkVersion PROP_MIN_SDK_VERSION
- targetSdkVersion PROP_TARGET_SDK_VERSION
- versionCode 103
- versionName "1.0.3"
- externalNativeBuild {
- cmake {
- targets "cocos"
- arguments "-DRES_DIR=${RES_PATH}", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
- }
- ndk { abiFilters PROP_APP_ABI.split(':') }
- }
- }
- sourceSets.main {
- java.srcDirs "../src", "src"
- res.srcDirs "../res", 'res', "${RES_PATH}/proj/res"
- jniLibs.srcDirs "../libs", 'libs'
- manifest.srcFile "AndroidManifest.xml"
- assets.srcDirs "${RES_PATH}/data", "src/main/assets"
- jniLibs {
- // Vulkan validation layer
- // srcDir "${android.ndkDirectory}/sources/third_party/vulkan/src/build-android/jniLibs"
- }
- }
- externalNativeBuild {
- cmake {
- version "3.22.1"
- 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
- }
- }
- }
- def appName = URLDecoder.decode("${PROP_APP_NAME}", "UTF-8")
- buildTypes {
- release {
- debuggable false
- jniDebuggable false
- renderscriptDebuggable false
- minifyEnabled true
- shrinkResources true
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- if (project.hasProperty("RELEASE_STORE_FILE")) {
- signingConfig signingConfigs.release
- }
- externalNativeBuild {
- cmake {
- // switch HIDE_SYMBOLS to OFF to skip compilation flag `-fvisibility=hidden`
- arguments "-DHIDE_SYMBOLS=ON"
- }
- }
- if (!Boolean.parseBoolean(PROP_IS_DEBUG)) {
- getIsDefault().set(true)
- }
- resValue "string", "app_name", "${appName}"
- buildConfigField "String", "ATMOB_CENTRAL_APP_KEY", "\"$atmob_central_app_key\""
- buildConfigField "String", "GRAVITY_ACCESS_TOKEN", "\"$gravity_access_token\""
- buildConfigField "String", "TEST_CHANNEL", "\"$test_channel\""
- buildConfigField "String", "YIDUN_PRODUCT_ID", "\"$yidun_product_id\""
- buildConfigField "String", "YIDUN_REGISTER_BUSINESS_ID", "\"$yidun_register_business_id\""
- buildConfigField "String", "WECHAT_APP_ID", "\"$wechat_app_id\""
- buildConfigField "String", "ALIPAY_APP_ID", "\"$alipay_app_id\""
- buildConfigField "String", "UMENG_APP_KEY", "\"$umeng_app_key\""
- buildConfigField "String", "PROD_SERVER_HOST", "\"$prod_server_host\""
- buildConfigField "String", "TEST_SERVER_HOST", "\"$test_server_host\""
- buildConfigField "boolean", "IS_PROD_SERVER", "true"
- }
- debug {
- debuggable true
- jniDebuggable true
- renderscriptDebuggable true
- minifyEnabled false
- shrinkResources false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- if (project.hasProperty("RELEASE_STORE_FILE")) {
- signingConfig signingConfigs.release
- }
- externalNativeBuild {
- cmake {
- // switch HIDE_SYMBOLS to OFF to skip compilation flag `-fvisibility=hidden`
- arguments "-DHIDE_SYMBOLS=ON"
- }
- }
- if (!Boolean.parseBoolean(PROP_IS_DEBUG)) {
- getIsDefault().set(true)
- }
- resValue "string", "app_name", "${appName}-debug"
- buildConfigField "String", "ATMOB_CENTRAL_APP_KEY", "\"$atmob_central_app_key\""
- buildConfigField "String", "GRAVITY_ACCESS_TOKEN", "\"$gravity_access_token\""
- buildConfigField "String", "TEST_CHANNEL", "\"$test_channel\""
- buildConfigField "String", "YIDUN_PRODUCT_ID", "\"$yidun_product_id\""
- buildConfigField "String", "YIDUN_REGISTER_BUSINESS_ID", "\"$yidun_register_business_id\""
- buildConfigField "String", "WECHAT_APP_ID", "\"$wechat_app_id\""
- buildConfigField "String", "ALIPAY_APP_ID", "\"$alipay_app_id\""
- buildConfigField "String", "UMENG_APP_KEY", "\"$umeng_app_key\""
- buildConfigField "String", "PROD_SERVER_HOST", "\"$prod_server_host\""
- buildConfigField "String", "TEST_SERVER_HOST", "\"$test_server_host\""
- buildConfigField "boolean", "IS_PROD_SERVER", "false"
- }
- }
- buildFeatures {
- buildConfig = true
- }
- configurations.configureEach {
- resolutionStrategy {
- // don't cache changing modules at all
- cacheChangingModulesFor 10, 'seconds'
- }
- }
- applicationVariants.configureEach { variant ->
- def date = new Date().format("YYMMddHHmmss")
- variant.outputs.configureEach {
- def fileName = "${defaultConfig.applicationId}" +
- "-v${defaultConfig.versionName}" +
- "-${variant.buildType.name}" +
- "-${date}" +
- ".apk"
- outputFileName = fileName
- }
- }
- }
- 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')
- if (Boolean.parseBoolean(PROP_ENABLE_INPUTSDK)) {
- implementation 'com.google.android.libraries.play.games:inputmapping:1.1.0-beta'
- implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.10"
- }
- implementation "atmob.central:cocos-bridge:0.0.1-SNAPSHOT"
- implementation "androidx.constraintlayout:constraintlayout:2.1.4"
- }
|