- **环境** path中加入`D:\apps\android-studio\gradle\gradle-2.4\bin`,因为我要使用本地的gradle
- **打包**
- 命令
1. `gradle.bat app:assembleRelease`#打全部包
1. `gradle.bat app:assembleDevRelease`#只打测试包
1. `gradle.bat app:assembleStageRelease`
1. `gradle.bat app:assembleProductRelease`
- 生成文件在`app\build\outputs\apk`
- **文件`app\build.gradle`**
> android {
> signingConfigs {
> config {
> storeFile file(RELEASE_STORE_FILE)
> storePassword RELEASE_STORE_PASSWORD
> keyAlias RELEASE_KEY_ALIAS
> keyPassword RELEASE_KEY_PASSWORD
> }
> }
> //flavors
> productFlavors {
> dev {
> buildConfigField "String", "API_BASE_URI", '"http://wms.test.yunshanmeicai.com/"'
> resValue "string", "api_name", "test"
> }
> stage {
> buildConfigField "String", "API_BASE_URI", '"http://wms.stage.yunshanmeicai.com/"'
> resValue "string", "api_name", "stage"
> }
> product {
> buildConfigField "String", "API_BASE_URI", '"http://beta.wms.yunshanmeicai.com/"'
> resValue "string", "api_name", "正式"
> }
> }
> }
- **文件`gradle.properties`**
> systemProp.http.proxyHost=127.0.0.1
> systemProp.http.proxyPort=1080
> systemProp.https.proxyHost=127.0.0.1
> systemProp.https.proxyPort=1080
>
>
> RELEASE_STORE_FILE=catuncle.jks
> RELEASE_STORE_PASSWORD=123456
> RELEASE_KEY_ALIAS=catuncle
> RELEASE_KEY_PASSWORD=123456
网友评论