I have Android Studio 1.3.1. When I open old project, with Grandle
lower 1.0.0 version, upgrade it, change flavorGroups =>
flavorDimensions, packageName => applicationId, runProguard =>
minifyEnabled. And I have error: "Error:Flavor 'amazon' has no flavor
dimension". When I remark amazon productFlavor, the error on google. My
code is:
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionName = "1.3.3"
versionCode = 33
}
flavorDimensions "market", "version"
project.archivesBaseName = "pp"
signingConfigs {
production {
storeFile file("XXX")
storePassword "XXXXXX"
keyAlias "My App"
keyPassword "XXXXX"
}
}
buildTypes {
debug {
minifyEnabled false
}
release {
minifyEnabled false
proguardFile 'proguard-project.txt'
debuggable false
signingConfig signingConfigs.production
}
}
productFlavors {
amazon {
flavorDimensions "market"
}
google {
flavorDimensions "market"
}
}
lintOptions {
abortOnError false
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
def apk = output.outputFile;
def newName = "${output.name}-${variant.mergedFlavor.versionCode}"
if (variant.buildType.versionNameSuffix) {
newName += "-${variant.buildType.versionNameSuffix}"
}
if (output.zipAlign) {
output.zipAlign.outputFile = new File((File) apk.parentFile, newName + '-aligned.apk');
}
output.packageApplication.outputFile = new File((File) apk.parentFile, newName + ".apk")
}
}