Pulltorefresh 添加到 gradle [英] Pulltorefresh add to gradle

查看:43
本文介绍了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'

这篇关于Pulltorefresh 添加到 gradle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆