Sfoglia il codice sorgente

提交build.gradle

mojunshou 7 mesi fa
parent
commit
4723cfaa9e
1 ha cambiato i file con 38 aggiunte e 3 eliminazioni
  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
         minSdkVersion PROP_MIN_SDK_VERSION
         targetSdkVersion PROP_TARGET_SDK_VERSION
-        versionCode 1
+        versionCode 100
         versionName "1.0.0"
 
         externalNativeBuild {
@@ -63,6 +63,8 @@ android {
         }
     }
 
+    def appName = URLDecoder.decode("${PROP_APP_NAME}" , "UTF-8")
+
     buildTypes {
         release {
             debuggable false
@@ -86,6 +88,8 @@ android {
                 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\""
@@ -101,8 +105,26 @@ android {
             debuggable true
             jniDebuggable 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", "GRAVITY_ACCESS_TOKEN", "\"$gravity_access_token\""
             buildConfigField "String", "TEST_CHANNEL", "\"$test_channel\""
@@ -125,6 +147,19 @@ android {
             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 {