Search code examples
androidactionbarsherlockgradle

How to build Sherlock with gradle from command line?


I'm trying to build Sherlock with Gradle from command line. I'm trying to build the Sherlock library itself. Here's what I did:

1) I used Eclipse File|Export|Create Gradle build files and got me a build.gradle for Sherlock.

2) Now I go to sherlock/actionbarsherlock and do gradle build from command line

3) Now it starts building fine but then it gives errors as if the Java Compiler version is 1.5. It complains about overriding interface methods.

C:\sherlock\actionbarsherlock\src\com\actionbarsherlock\app\Sherlock
Fragment.java:22: error: method does not override or implement a method from a supertype
    @Override

I wonder why is it so?

In Android Studio it builds fine but I can't build from the command line.

Here's my build.gradle for Sherlock but then it's generated by Eclipse I changed nothing.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.4'
    }
}
apply plugin: 'android-library'

dependencies {
}

android {
    compileSdkVersion 17
    buildToolsVersion "17"

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

Solution

  • I think you missed to add it to the dependecies

    dependencies {
        compile files('libs/android-support-v4.jar')
    }