有时根据项目需要,AndroidManifest.xml中的meta-data的值分测试和正式
为了能自动地更换meta-data值,就需要用到manifestPlaceholders
语法:manifestPlaceholders = [FieldName: FieldValue]
示例如下
build.gradle (Module: app)
apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "com.bu_ish.debug_release_test" minSdkVersion 19 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' buildConfigField "String", "TextToShow", "\"当前处于发布模式\""