Install ActionBarSherlock 4.4 in Android Studio

2019-02-11 09:17发布

问题:

I need help installing/implementing ActionBarSherlock 4.4.0 into Android Studio 0.2.3. I have tried multiple tutorials and looked through answers on here. But none have worked for this beginner.

Has anyone tried to install ABS 4.4.0 into Android Studio yet? Can anyone give me detailed step by step instructions on how to do this? Or point me to an answer or tutorial that will help?

回答1:

I successfully added it as aar dependency, no need to download and compile any sources.

  1. Open Tools -> Android -> SDK Manager and install latest platform and build tools 18.0.1.

  2. Create new project with Android Studio for Android 2.1 (API level 7) and replace build.gradle of subproject (not the top one) with the one below.

Complete minimal build.gradle, it needs Android Build Tools version 18:

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

apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 18
    buildToolsVersion "18.0.1"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 18
    }
}

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


回答2:

If you are already using Android Studio, you might do it the GUI way.

This also allows you to search the Maven repo, so if you don't know the full name of the library no worries.

  • Press CTRL+ALT+SHIFT+S
  • Select the module
  • Click Dependencies
  • Click the green arrow
  • Input sherlock and press enter to search
  • Select com.actionbarsherlock:actionbarsherlock:4.4.0@aar

This will automatically add it to your build.gradle