所以我很努力在Android Studio v0.2中用Gradle v1.6设置一个非常简单的项目。 我想创建一个使用ActionBarSherlock的简单应用程序,所以我在Android Studio中创建了一个Project。
在创建项目的同一根文件夹中,我下载了最新的ABS。如何在Android Studio for ActionBarSherlock中正确设置Gradle?
因此,这里是我的结构:
|ABSAppProject
|..settings.gradle
|..build.gradle
|--ABSApp
|....build.gradle
|actionbarsherlock
|..build.gradle
在根settings.gradle
,我有:
include ':ABSApp'
include 'actionbarsherlock'
project(':actionbarsherlock').projectDir=new File('actionbarsherlock')
在actionbarsherlock/build.gradle
我:
apply plugin: 'android-library'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
dependencies {
compile 'com.google.android:support-v4:r7'
}
android {
compileSdkVersion 14
buildToolsVersion '17'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
而且,终于在中,我有:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:r7'
compile project (':actionbarsherlock')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 16
}
}
root build.gradle为空。
建设时,(使用gradle这个构建--info)我得到:
Starting Build
Settings evaluated using settings file '/Users/m/Documents/Projects/ABSAppProject/settings.gradle'.
Projects loaded. Root project using build file '/Users/ma/Documents/Projects/ABSAppProject/build.gradle'.
Included projects: [root project 'ABSAppProject', project ':ABSApp', project ':actionbarsherlock']
Evaluating root project 'ABSAppProject' using build file '/Users/m/Documents/Projects/ABSAppProject/build.gradle'.
Evaluating project ':ABSApp' using build file '/Users/m/Documents/Projects/ABSAppProject/ABSApp/build.gradle'.
Evaluating project ':actionbarsherlock' using empty build file.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':ABSApp'.
> Failed to notify project evaluation listener.
> Configuration with name 'default' not found.
构建ABS库单独使用摇篮似乎好的工作,让gradle.build文件可能是好的。
我在做什么错?
你解决了吗?我也遇到了麻烦.. – Rob