Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle fails to build ActionBarSherlock

I'm using new Android studio, based on IDEA, and trying to build project with ABS library in dependencies for the main module. And I'm getting errors:

Gradle: package com.actionbarsherlock.app does not exist
Gradle: cannot find symbol class SherlockActivity
Gradle: package com.actionbarsherlock.view does not exist
Gradle: cannot find symbol variable super
Gradle: cannot find symbol method setContentView(int)
....

Why and how to fix it?

like image 612
artem Avatar asked May 16 '13 09:05

artem


3 Answers

I used build ok.

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

dependencies {
       compile 'com.android.support:support-v4:13.0.0'
}

android {
compileSdkVersion 17
buildToolsVersion "17"

defaultConfig {
    minSdkVersion 7
    targetSdkVersion 17
}
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')
}
}
like image 122
Crossle Song Avatar answered Oct 20 '22 03:10

Crossle Song


I was putting this as a comment because I wasn't sure if its your exact issue but it looks like abs isn't added as a module correctly. So I added as an answer

Try download abs fresh, extract it then in Android Studio - file > import module... and import the actionbarsherlock directory. After this however I had a error relating to junit so check the last steps in below post

Follow the steps here: Problems importing project into Android Studio regarding ActionBarSherlock

That post isn't your exact issue but the steps got abs working for me. so try that within your existing project

like image 25
wired00 Avatar answered Oct 20 '22 02:10

wired00


I did the import module, but i still had to add ActionBarSherlock as a dependency and then that got it working.

(actually i had the toplevel exception for mismatched support libs too, but then i got it working)

like image 35
mlmkvr Avatar answered Oct 20 '22 02:10

mlmkvr