简体   繁体   English

在Android项目中使用gradle的问题

[英]issue using gradle in an android project

I almost know nothing form Android , I created a project and then I wanted to use some plugin based on Gradle , so I added some build.gradle file. 我几乎对Android一无所知,我创建了一个项目,然后想使用一些基于Gradle插件,所以我添加了一些build.gradle文件。 I added there 我加在那里

apply plugin: 'android'

dependencies {
    mavenCentral()
    compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
}

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}

android {
    compileSdkVersion 18
    buildToolsVersion '18'

    defaultConfig {
        targetSdkVersion 18
    }

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

The doc says import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout; 该文件说import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout; to private PullToRefreshLayout mPullToRefreshLayout; private PullToRefreshLayout mPullToRefreshLayout; But, this package can not be resolved. 但是,该程序包无法解决。 Someone can help ? 有人可以帮忙吗?

Change this: 更改此:

dependencies {
    mavenCentral()
    compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
}

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}

To this: 对此:

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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