Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
208 views
in Technique[技术] by (71.8m points)

android studio - Pulltorefresh add to gradle

can anyone help me add this library in build.gradle Android Studio.

https://github.com/chrisbanes/Android-PullToRefresh

I know it is deprecated but I want to use it, I would appreciate if someone could help me

what to write in

dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:appcompat-v7:+'
compile '????'
}

as mentioned I want to use the deprecated library not new Actionbar-Pulltorefresh. tried to google it but couldn't find any help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I suggest you to use ActionBarPullToRefresh (same author).

However, if you would like to use PullToRefresh, you have to clone the lib locally in a folder, and then add it as local dependency. This lib isn't on Central Maven as aar.

root
  app
    build.gradle
  lib
    pull
      src
      res
      build.gradle
  settings.gradle

In you app/build.gradle you have to add:

dependencies {
    // Library
    compile project(':lib:pull')
}

In lib/pull/build.gradle you have to define it as library and specify the right sourceset (it is a gist):

apply plugin: 'android-library'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

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

In settings.gradle:

include ':lib:pull' ,':app'

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...