Pulltorefresh 添加到 gradle

Pulltorefresh 添加到 gradle

问题描述:

谁能帮我在 build.gradle Android Studio 中添加这个库.

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

写什么

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

如前所述,我想使用已弃用的库,而不是新的 Actionbar-Pulltorefresh.试图用谷歌搜索但找不到任何帮助.

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

我建议你使用 ActionBarPullToRefresh(同一作者).

I suggest you to use ActionBarPullToRefresh (same author).

但是,如果您想使用PullToRefresh,则必须在本地将lib 克隆到一个文件夹中,然后将其添加为本地依赖项.这个库不在中央 Maven 上作为 aar.

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

在你的 app/build.gradle 中你必须添加:

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

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

在 lib/pull/build.gradle 中,您必须将其定义为库并指定正确的源集(这是一个要点):

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']
        }
    }
}

在 settings.gradle 中:

In settings.gradle:

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