国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Android > 正文

Android build.gradle版本名打包配置的方法

2019-10-21 21:25:31
字體:
供稿:網(wǎng)友

1、生成密鑰文件到app工程目錄下

Android,build.gradle,打包配置

Android,build.gradle,打包配置

Android,build.gradle,打包配置

2、在gradle.properties文件下配置密鑰文件信息

# Project-wide Gradle settings.# IDE (e.g. Android Studio) users:# Gradle settings configured through the IDE *will override*# any settings specified in this file.# For more details on how to configure your build environment visit# http://www.gradle.org/docs/current/userguide/build_environment.html# Specifies the JVM arguments used for the daemon process.# The setting is particularly useful for tweaking memory settings.org.gradle.jvmargs=-Xmx1536m# When configured, Gradle will run in incubating parallel mode.# This option should only be used with decoupled projects. More details, visit# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects# org.gradle.parallel=trueRELEASE_KEY_PASSWORD=key-passwordRELEASE_KEY_ALIAS=key-aliasRELEASE_STORE_PASSWORD=store-password#jks文件名RELEASE_STORE_FILE=sugr-ivy.jks

3、build.gradle文件下配置

apply plugin: 'com.android.application'android {  compileSdkVersion 26  project.archivesBaseName = "AppName"  defaultConfig {    applicationId "com.example.app"    minSdkVersion 23    targetSdkVersion 26    versionCode 1    versionName "1.4.0"    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"  }  signingConfigs {    release {      keyAlias RELEASE_KEY_ALIAS      keyPassword RELEASE_KEY_PASSWORD      storeFile file(RELEASE_STORE_FILE)      storePassword RELEASE_STORE_PASSWORD    }    debug {      keyAlias RELEASE_KEY_ALIAS      keyPassword RELEASE_KEY_PASSWORD      storeFile file(RELEASE_STORE_FILE)      storePassword RELEASE_STORE_PASSWORD    }  }  buildTypes {    release {      buildConfigField "boolean", "LOG_DEBUG", "false" // 不顯示Log      minifyEnabled false           //混淆      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'      signingConfig signingConfigs.release  //簽名    }    debug {      signingConfig signingConfigs.debug  //簽名    }  }  applicationVariants.all {    variant ->      variant.outputs.all {        Calendar calendar = Calendar.getInstance(Locale.CHINA);        def buildDate = String.format(Locale.CHINA, "%04d%02d%02d", calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.DAY_OF_MONTH))        def versionName = defaultConfig.versionName        def versionCode = defaultConfig.versionCode        //android studio3.0之前的寫法        //  output->output.outputFile=new File(output.outputFile.parent,output.outputFile.name.replace(".apk","-"+defaultConfig.versionName+".apk"))        //android studio3.0的寫法        //項(xiàng)目名-版本名-版本號-release/debug.apk        if (variant.buildType.name.equals('release')) {          outputFileName = "${project.archivesBaseName}-v${versionName}-c${versionCode}-${buildDate}-release.apk"        } else {          outputFileName = "${project.archivesBaseName}-v${versionName}-c${versionCode}-${buildDate}-debug.apk"        }      }  }}dependencies {  implementation fileTree(dir: 'libs', include: ['*.jar'])  testImplementation 'junit:junit:4.12'  androidTestImplementation 'com.android.support.test:runner:1.0.2'  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'  implementation 'com.android.support:appcompat-v7:26.1.0'  implementation 'com.android.support.constraint:constraint-layout:1.1.3'  implementation 'com.android.support:multidex:1.0.3'  implementation 'com.android.support:recyclerview-v7:26.1.0'}

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持VEVB武林網(wǎng)。


注:相關(guān)教程知識閱讀請移步到Android開發(fā)頻道。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 大新县| 墨玉县| 株洲县| 乾安县| 财经| 淳化县| 长乐市| 沭阳县| 西藏| 高密市| 连平县| 庄浪县| 保德县| 白山市| 西丰县| 牙克石市| 长岭县| 江门市| 鄂伦春自治旗| 唐海县| 南江县| 昆山市| 宁化县| 正宁县| 河津市| 石首市| 凤阳县| 鹤山市| 莱西市| 龙门县| 陆河县| 黎川县| 岗巴县| 泽州县| 砚山县| 绿春县| 庄河市| 虎林市| 通城县| 徐汇区| 蕲春县|