Library build.gradle:
apply plugin: 'com.android.library' android { .... publishNonDefault true productFlavors { market1 {} market2 {} } }
project build.gradle:
apply plugin: 'com.android.application' android { .... productFlavors { market1 {} market2 {} } } dependencies { .... market1Compile project(path: ':lib', configuration: 'market1Release') market2Compile project(path: ':lib', configuration: 'market2Release') }
转自:https://stackoverflow.com/questions/24860659/multi-flavor-app-based-on-multi-flavor-library-in-andro