ActionBar Sherlock与Android Studio 0.2.2

时间:2013-07-30 10:56:12

标签: android actionbarsherlock gradle android-studio build.gradle

我正在使用ActionBar Sherlock和Android Studio开发一个演示应用。 Android Studio版本为0.2.2,gradle版本为1.6,插件版本为0.5.1,我遵循以下教程: -

www.grokkingandroid.com
showlabor.blogspot.ca

我收到以下错误: -

 Gradle: Execution failed for task ':libraries:ActionBarSherlock:actionbarsherlock:compileReleaseAidl'.tried to access class com.android.build.gradle.internal.tasks.DependencyBasedCompileTask$DepFileProcessor from class com.android.build.gradle.internal.tasks.DependencyBasedCompileTask

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:18.0.+'
}

android {
  compileSdkVersion 17
  buildToolsVersion '17.0.0'

    defaultConfig {
        minSdkVersion 7
        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')
    }

 }

我的项目构建文件是这样的: -

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}
dependencies {
    compile 'com.android.support:support-v4:13.0.+'
}
dependencies {
    compile project(':libraries:ActionBarSherlock:actionbarsherlock')
}
android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 16
    }
}

对此的任何线索都非常感谢

谢谢:)

2 个答案:

答案 0 :(得分:7)

尝试

dependencies {
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile 'com.android.support:support-v4:13.0.+'
}

答案 1 :(得分:0)

我遇到了同样的错误,直到我使用相同的gradle文件作为ABS和gradle示例中的gradle文件,这是一个有效的示例项目:https://github.com/JakeWharton/ActionBarSherlock-Gradle-Sample