0

So, I just switched to Android Studio. I imported my projects and they are all working fine. My problem is that I don't have a clue on how to import librarys (ActionBarSherlock, SlidingMenu...). I read a few posts about it but I didn't understand this gradle and maven thing. I'm not asking for a guide, if someone could point me the directions I would be gratefull.

Edit:

buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar' } } apply plugin: 'android' android { compileSdkVersion 19 buildToolsVersion '19.0.1' defaultConfig { minSdkVersion 15 targetSdkVersion 19 versionCode 10 versionName "1.0" } 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') debug.setRoot('build-types/debug') release.setRoot('build-types/release') } 

}

1 Answer 1

2

You can simple add this to your app's build.gradle (the inner most one):

dependencies { compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar' } 

Then you press the Sync Projects with Gradle Files button below the menu bar. If in the future you need to add other libraries that are in maven central, you could use Gradle Please.

Sign up to request clarification or add additional context in comments.

3 Comments

I did it, but gives me a 'Unresolved depencecies', Error:com.actionbarsherlock:actionbarsherlock:4.4.0.
Can you edit you question and post how your build.gradle looks?
I was able to fixed it, this helped me to understand (github.com/JakeWharton/ActionBarSherlock-Gradle-Sample/blob/…) the build.gradle. You pointed me in the right direction, so thanks friend.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.