简体   繁体   中英

Android Gradle library dependency

Hi I have following android project:

   buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.6.+'
    }
}

apply plugin: 'android'

dependencies {
    compile files('libs/android-support-v4.jar')
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
}

repositories {
    mavenCentral()
}

android {
    buildToolsVersion "17.0"
    compileSdkVersion 17

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
    }
}

Now I would like to add another dependency: https://github.com/bauerca/drag-sort-listview . I tried adding

    compile 'com.mobeta.android.dslv:drag-sort-listview:0.6.1-SNAPSHOT'

but it doesn't work. How can I add this project as a Gradle dependency? I saw that there is an option to copy this library as a subdirectory in my project dir. How should I include such a project?

The author of the library has to upload @aar bundle to maven central repository to make it work. As you can see drag sort listview is no longer mainted by author. You can use repo from the community as temporal solution.

repositories {
    mavenCentral()
    maven {
        url 'https://github.com/Goddchen/mvn-repo/raw/master/'
    }
}

dependencies {
    compile files('libs/android-support-v4.jar')
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile 'com.mobeta.android.dslv:drag-sort-listview:0.6.1'
}

In general case you have to download sources and add them as library to your project.

I like to recommend you to use this library instead.

I thinks https://github.com/ened is thanksfully made the library for gradle and maintained it for a while.

compile 'asia.ivity.android:drag-sort-listview:1.0'
<dependency>
    <groupId>asia.ivity.android</groupId>
    <artifactId>drag-sort-listview</artifactId>
    <version>1.0</version>
</dependency>

http://mvnrepository.com/artifact/asia.ivity.android/drag-sort-listview/1.0

https://github.com/ened/drag-sort-listview

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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