我已经阅读了大量不同的Stack Overflow帖子和各种博客,它们都提供了不同的方法来使这些库与android studio一起工作,但我还没有成功使用它们。
我目前正在使用android studio 0.2.5。
尝试运行gradlew汇编时遇到的当前错误:
出了什么问题:
任务执行失败':libraries:ActionBarSherlock:actionbarsherlock:compileReleaseAidl'。
尝试从类com.android.build.gradle.i访问类com.android.build.gradle.internal.tasks.DependencyBasedCompileTask $ DepFileProcessor nternal.tasks.DependencyBasedCompileTask
我的项目结构如下:
|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文件都在下面:
MyProject - > MyProject - >的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')
}
}
MyProject - > 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更新程序工具必须更新的所有内容,但仍然没有运气。
答案 0 :(得分:2)
您是否在项目结构中为项目添加了依赖项