Android app design with 3 fragrances, 3 buildTypes and 2 applicationIdSuffixes

When I create my project trying to combine flavors wearApp and buildTypes with applicationIdSuffixes, I get the following error message:

Error:Execution failed for task ':app:handleFirstCustomerTestMicroApk'. > The main and the micro apps do not have the same package name. 

From my application /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') } 

From my wear / 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 } 

I know from them that <buildType>WearApp possible, but I really need <flavor><BuildType>WearApp (which now does not seem possible):

Retaining all of the above wearApp type dependencies if I remove appIdSuffixes, but then it still builds one of them apk per buildType no matter what type of buildType I choose in Android Studio, and I really need an IdSuffixes application.

Does anyone have a workaround for this? Today, I add and remove wearApp dependencies manually every time I need to change my buildType type and / or taste, and this is not quite the solution that I find it convenient in the end.

EDIT: I didn't notice this at first, but for some reason, the firstDebug, secondDebug, and thirdDebug options build just fine with all 9 wearApp dependencies in build.gradle. The error message remains unchanged for firstCustomerTest, firstRelease, secondCustomerTest, secondRelease, thirdCustomerTest and thirdRelease. All options will compile 9 wearApps each time, it would be neatly reduced to 1.

+29
android android-wear build.gradle android-productflavors android-build-type
Nov 10 '15 at 13:17
source share
1 answer

According to This Post

try it

 configurations { firstDebugWearApp firstCustomerTestWearApp firstReleaseWearApp secondDebugWearApp ...// And all the others } dependencies { firstDebugWearApp project(path: ':wear', configuration: 'firstDebug') firstCustomerTestWearApp project(path: ':wear', configuration: 'firstCustomerTest') firstReleaseWearApp project(path: ':wear', configuration: 'firstRelease') secondDebugWearApp project(path: ':wear', configuration: 'secondDebug') secondCustomerTestWearApp project(path: ':wear', configuration: 'secondCustomerTest') secondReleaseWearApp project(path: ':wear', configuration: 'secondRelease') thirdDebugWearApp project(path: ':wear', configuration: 'thirdDebug') thirdCustomerTestWearApp project(path: ':wear', configuration: 'thirdCustomerTest') thirdReleaseWearApp project(path: ':wear', configuration: 'thirdRelease') } 
+8
Feb 04 '16 at 8:24
source share



All Articles