简体   繁体   English

如何将库(Actionbarhserlock)导入Android Studio

[英]How to import library (Actionbarhserlock) to Android Studio

So, I just switched to Android Studio. 所以,我刚刚切换到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...). 我的问题是我没有关于如何导入库的线索(ActionBarSherlock,SlidingMenu ......)。 I read a few posts about it but I didn't understand this gradle and maven thing. 我读了一些关于它的帖子,但我不明白这个gradle和maven的事情。 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')
}

} }

You can simple add this to your app's build.gradle (the inner most one): 你可以简单地将它添加到你的app的build.gradle (最里面的一个):

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

Then you press the Sync Projects with Gradle Files button below the menu bar. 然后按菜单栏下方的“ Sync Projects with Gradle Files按钮。 If in the future you need to add other libraries that are in maven central, you could use Gradle Please . 如果将来你需要添加maven central中的其他库,你可以使用Gradle Please

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM