我已经阅读了一堆不同的 Stack Overflow 帖子和各种博客,它们都提供了让这些库与 android studio 一起工作的不同方法,但我还没有成功地使用它们。
我目前正在使用 android studio 0.2.5。
我在尝试运行 gradlew assemble 时遇到的当前错误:
什么地方出了错:
任务 ':libraries:ActionBarSherlock:actionbarsherlock:compileReleaseAidl' 执行失败。
试图从类 com.android.build.gradle.internal.tasks.DependencyBasedCompileTask 访问类 com.android.build.gradle.internal.tasks.DependencyBasedCompileTask$DepFileProcessor
我的项目结构如下:
|MyProject
----|MyProject
----|libraries
--------|ActionBarSherlock
------------|actionbarsherlock
----------------build.gradle
------------|actionbarsherlock-fest
------------|actionbarsherlock-i18n
------------|actionbarsherlock-samples
------------build.gradle
------------settings.gradle
--------|SlidingMenu
------------|library
----------------build.gradle
----|MyProject
----build.gradle
settings.gradle
所有 build.gradle 文件如下:
我的项目 - > 我的项目 - > build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 16
targetSdkVersion 16
}
}
dependencies {
compile 'com.android.support:support-v4:13.0.0'
compile files('libs/Parse-1.3.3/Parse-1.3.3.jar')
compile project(':libraries:ActionBarSherlock:actionbarsherlock')
compile project(':libraries:SlidingMenu:library')
}
MyProject -> 库 -> ActionBarSherlock -> build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
allprojects {
group = 'com.actionbarsherlock'
version = '4.4.0'
repositories {
mavenCentral()
}
tasks.withType(Compile) {
options.encoding = "UTF-8"
}
}
MyProject -> 库 -> ActionBarSherlock -> actionbarsherlock -> build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:13.0.0'
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 16
targetSdkVersion 16
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
MyProject -> 库 -> ActionBarSherlock -> settings.gradle
include 'actionbarsherlock'
include 'actionbarsherlock-fest'
include 'actionbarsherlock-i18n'
MyProject -> 库 -> SlidingMenu -> 库 -> build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android-library'
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:13.0.0'
compile project(':libraries:ActionBarSherlock:actionbarsherlock')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 16
targetSdkVersion 16
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
我的项目 - > settings.gradle
include ':MyProject', ':libraries:SlidingMenu:library', ':libraries:ActionBarSherlock:actionbarsherlock'
我认为这是所有重要文件,但如果我错过了请告诉我。
感谢您提供的任何建议!
编辑1:
确保所有 build.gradle 文件都有:
compileSdkVersion 16
buildToolsVersion "18.0.1"
因为有些不同。
确保所有清单都有:
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="16"/>
我还更新了 sdk updater 工具必须更新的所有内容,但仍然没有运气。