android studio actionbarsherlock,如何在Android Studio中为ActionBarSherlock正确设置Gradle?

林鹏鹍
2023-12-01

因此,我很难在

Android Studio v0.2中使用Gradle v1.6设置一个非常简单的项目.

我想创建一个使用ActionBarSherlock的简单应用程序,因此我在Android Studio中创建了一个Project.

在创建项目的同一根文件夹中,我已经下载了最新的ABS.

所以这是我的结构:

|ABSAppProject

|..settings.gradle

|..build.gradle

|--ABSApp

|....build.gradle

|actionbarsherlock

|..build.gradle

在root 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']

}

}

}

最后,在ABSApp / build.gradle中,我有:

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

}

}

根build.gradle为空.

在构建时,(使用gradle build –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.

使用Gradle单独构建ABS库似乎工作正常,因此gradle.build文件可能没问题.

我究竟做错了什么?

 类似资料: