Browse Source

提交build.gradle

mojunshou 7 months ago
parent
commit
4723cfaa9e
1 changed files with 38 additions and 3 deletions
  1. 38 3
      native/engine/android/app/build.gradle

+ 38 - 3
native/engine/android/app/build.gradle

@@ -19,7 +19,7 @@ android {
         applicationId APPLICATION_ID
         applicationId APPLICATION_ID
         minSdkVersion PROP_MIN_SDK_VERSION
         minSdkVersion PROP_MIN_SDK_VERSION
         targetSdkVersion PROP_TARGET_SDK_VERSION
         targetSdkVersion PROP_TARGET_SDK_VERSION
-        versionCode 1
+        versionCode 100
         versionName "1.0.0"
         versionName "1.0.0"
 
 
         externalNativeBuild {
         externalNativeBuild {
@@ -63,6 +63,8 @@ android {
         }
         }
     }
     }
 
 
+    def appName = URLDecoder.decode("${PROP_APP_NAME}" , "UTF-8")
+
     buildTypes {
     buildTypes {
         release {
         release {
             debuggable false
             debuggable false
@@ -86,6 +88,8 @@ android {
                 getIsDefault().set(true)
                 getIsDefault().set(true)
             }
             }
 
 
+            resValue  "string", "app_name", "${appName}"
+
             buildConfigField "String", "ATMOB_CENTRAL_APP_KEY", "\"$atmob_central_app_key\""
             buildConfigField "String", "ATMOB_CENTRAL_APP_KEY", "\"$atmob_central_app_key\""
             buildConfigField "String", "GRAVITY_ACCESS_TOKEN", "\"$gravity_access_token\""
             buildConfigField "String", "GRAVITY_ACCESS_TOKEN", "\"$gravity_access_token\""
             buildConfigField "String", "TEST_CHANNEL", "\"$test_channel\""
             buildConfigField "String", "TEST_CHANNEL", "\"$test_channel\""
@@ -101,8 +105,26 @@ android {
             debuggable true
             debuggable true
             jniDebuggable true
             jniDebuggable true
             renderscriptDebuggable true
             renderscriptDebuggable true
-            // resValue  "string", "app_name", "${PROP_APP_NAME}-dbg"
-            // applicationIdSuffix ".debug"
+            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", "ATMOB_CENTRAL_APP_KEY", "\"$atmob_central_app_key\""
             buildConfigField "String", "GRAVITY_ACCESS_TOKEN", "\"$gravity_access_token\""
             buildConfigField "String", "GRAVITY_ACCESS_TOKEN", "\"$gravity_access_token\""
             buildConfigField "String", "TEST_CHANNEL", "\"$test_channel\""
             buildConfigField "String", "TEST_CHANNEL", "\"$test_channel\""
@@ -125,6 +147,19 @@ android {
             cacheChangingModulesFor 10, 'seconds'
             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 {
 dependencies {