项目A:Actionbarsherlock 项目B:SlidingMenu 项目C:myAPP
A是B和C的图书馆项目; B是C;
的图书馆项目所以如何编写build.gradle和settings.gradle。
下面是我的文件: Actionbarsherlock:构建gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
apply plugin: 'android-library'
android {
compileSdkVersion 17
buildToolsVersion "17"
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
}
dependencies {
compile group: 'com.google.android', name: 'support-v4', version: 'r7'
}
sourceSets {
main {
manifest {
srcFile 'AndroidManifest.xml'
}
java {
srcDir 'src'
}
res {
srcDir 'res'
}
assets {
srcDir 'assets'
}
resources {
srcDir 'src'
}
aidl {
srcDir 'src'
}
}
}
}
这是B SlidingMenu的build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
apply plugin: 'android-library'
android {
compileSdkVersion 17
buildToolsVersion "17"
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
}
dependencies {
compile project(":actionbarsherlock")
compile group: 'com.google.android', name: 'support-v4', version: 'r7'
}
sourceSets {
main {
manifest {
srcFile 'AndroidManifest.xml'
}
java {
srcDir 'src'
}
res {
srcDir 'res'
}
assets {
srcDir 'assets'
}
resources {
srcDir 'src'
}
aidl {
srcDir 'src'
}
}
}
}
这是C myAPP build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
apply plugin: 'android'
android {
compileSdkVersion 17
buildToolsVersion "17"
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
}
dependencies {
compile project(":actionbarsherlock")
compile project(":SlidingMenu")
}
sourceSets {
main {
manifest {
srcFile 'AndroidManifest.xml'
}
java {
srcDir 'src'
}
res {
srcDir 'res'
}
assets {
srcDir 'assets'
}
resources {
srcDir 'src'
}
aidl {
srcDir 'src'
}
}
}
}
这是Project build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
allprojects {
repositories {
mavenCentral()
}
}
和settings.gradle
include 'actionbarsherlock'
include 'SlidingMenu'
include 'YueClient'
答案 0 :(得分:0)
可能不相关,
现在可以使用com.android.support:support-v4:13.0.+来获取兼容的操作栏而不是Sherlock。
在此处查看完整文档http://developer.android.com/reference/android/support/v7/app/ActionBarActivity.html