Proyecto de Android Wear con 3 sabores, 3 buildTypes y 2 applicationIdSuffixes
Cuando construyo mi proyecto después de intentar combinar los sabores wearApp y buildTypes con applicationIdSuffixes, aparece el siguiente mensaje de error:
Error:Execution failed for task ':app:handleFirstCustomerTestMicroApk'.
> The main and the micro apps do not have the same package name.
Desde mi aplicación / build.gradle:
buildTypes {
debug {
applicationIdSuffix '.debug'
debuggable true
embedMicroApp = true
}
customerTest {
applicationIdSuffix '.customertest'
debuggable true
embedMicroApp = true
}
release {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
minifyEnabled true
embedMicroApp = true
}
}
productFlavors {
first {
applicationId 'com.my.app.first'
}
second {
applicationId 'com.my.app.second'
}
third {
applicationId 'com.my.app.third'
}
}
dependencies {
firstWearApp project(path: ':wear', configuration: 'firstDebug')
firstWearApp project(path: ':wear', configuration: 'firstCustomerTest')
firstWearApp project(path: ':wear', configuration: 'firstRelease')
secondWearApp project(path: ':wear', configuration: 'secondDebug')
secondWearApp project(path: ':wear', configuration: 'secondCustomerTest')
secondWearApp project(path: ':wear', configuration: 'secondRelease')
thirdWearApp project(path: ':wear', configuration: 'thirdDebug')
thirdWearApp project(path: ':wear', configuration: 'thirdCustomerTest')
thirdWearApp project(path: ':wear', configuration: 'thirdRelease')
}
De mi desgaste / build.gradle:
buildTypes {
debug {
applicationIdSuffix '.debug'
minifyEnabled false
}
customerTest {
applicationIdSuffix '.customertest'
minifyEnabled false
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
productFlavors {
first {
applicationId 'com.my.app.first'
}
second {
applicationId 'com.my.app.second'
}
third {
applicationId 'com.my.app.third'
}
}
android {
publishNonDefault true
}
Sé de estos que<buildType>WearApp
es posible, pero lo que realmente necesito es<flavor><BuildType>WearApp
(que no parece posible en este momento):
Mantener todas las 9 dependencias de wearApp anteriores funciona si elimino el applicationIdSuffixes, pero sigue compilando un apk de uso por buildType, sin importar el tipo de build que elijo en Android Studio, y realmente necesito el applicationIdSuffixes.
¿Alguien tiene una solución para esto? A partir de hoy, agrego y elimino las dependencias de wearApp manualmente cada vez que necesito cambiar mi buildType y / o sabor, y no es exactamente una solución con la que me sienta cómodo a largo plazo.
EDITAR: No me di cuenta de esto al principio, pero por alguna razón las variantes firstDebug, secondDebug y thirdDebug se compilan perfectamente con las 9 dependencias de wearApp en build.gradle. Sin embargo, el mensaje de error sigue siendo el mismo para firstCustomerTest, firstRelease, secondCustomerTest, secondRelease, thirdCustomerTest y thirdRelease. Todas las variantes compilan las 9 WearApps cada vez, sería bueno reducir esto a 1.