I have a project with several flavors, with flavors called qa and prod. I need to include different versions of the library depending on the type of assembly and taste.
The documentation at http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Type-Product-Flavor-Build-Variant suggests that assembly types and tastes can be combined using notation "flavorBuildCompile". However, when I do this, I get this error:
Error:(88, 0) Gradle DSL method not found: 'qaDebugCompile()'
I am sure this worked (in the old version of gradle). Currently using gradle 2.1. I did not find an explanation whether the way to do this has changed.
Note that it works great if I use the flavorCompile notation, it only fails when I also include the build type.
Here is the outline of my build script:
android { compileSdkVersion 17 buildToolsVersion "20" ... productFlavors { qa { applicationId "com.myapp.qa" } prod { applicationId "com.myapp.prod" } } sourceSets { main { java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] manifest.srcFile 'AndroidManifest.xml' } qa { res.srcDirs = ['res_qa'] } prod { res.srcDirs = ['res_prod'] } } } ... dependencies { compile fileTree(dir: 'libs', include: '*.jar') qaCompile 'com.myapp.integration:other_lib: 3.0+@aar ' //this is fine qaDebugCompile 'com.myapp.integration:mylib_qa: 3.0+@aar ' //this fails! prodDebugCompile 'com.myapp.integration:mylib_prod: 3.0+@aar ' qaReleaseCompile 'com.myapp.release:mylib_qa: 3.0+@aar ' prodReleaseCompile 'com.myapp.release:mylib_prod: 3.0+@aar ' }
android gradle
Steve
source share