1

项目 A:Actionbarsherlock 项目 B:SlidingMenu 项目 C:myAPP

A是B和C的库项目;B是C的库项目;

那么如何编写build.gradle和settings.gradle。

下面是我的文件:A Actionbarsherlock: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 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'
        }
    }
}

}

这是项目 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'
4

1 回答 1

0

应该是不相干

您现在可以使用 com.android.support:support-v4:13.0.+ 来获得兼容的操作栏而不是 Sherlock。

在此处查看完整文档http://developer.android.com/reference/android/support/v7/app/ActionBarActivity.html

于 2014-01-09T13:59:11.100 回答