1import org.gradle.api.artifacts.Dependency; 2 3apply plugin: 'com.android.library' 4 5android { 6 sourceSets.main { 7 manifest.srcFile 'AndroidManifest.xml' 8 java.srcDirs = ['src'] 9 res.srcDirs = ['res'] 10 } 11} 12 13dependencies { 14 compile findDependency(':support-v4', 'com.android.support:support-v4:23.3.+') 15} 16 17Dependency findDependency(String projectName, String moduleName) { 18 if (findProject(projectName) != null) { 19 return dependencies.project(path: projectName) 20 } 21 22 return dependencies.create(moduleName) 23} 24