当debug和release版本使用不同的值时,使用Gradle设置相应的值。
Android主配置文件
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="${AMAP_KEY}" />
moulde中的build.gradle文件
buildTypes {
debug {
signingConfig signingConfigs.debug
manifestPlaceholders = [ AMAP_KEY:"09fd4efd3e28e9bf1f449ecec7d45afe" ]
}
release {
minifyEnabled true
zipAlignEnabled true
proguardFile('proguard.cfg')
signingConfig signingConfigs.release
manifestPlaceholders = [ AMAP_KEY:"ee20324fba1c7f4ad7a4a207e33d8e8d" ]
}
}