如何在android studio中集成pullToRefresh

时间:2014-09-08 16:50:38

标签: android gradle android-studio

我是gradle和android studion的新手。我从eclipse我的项目(通过导出)集成到gradle项目。几乎所有的lib都编译得很好,只有一个pushToRefresh列表不想添加.Every时间gradle告诉我这样的错误

java.lang.RuntimeException: Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 4

请帮我解决这个问题。还有来自主项目的gradle代码

    apply plugin: 'android'

dependencies {
    repositories {

    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':google-play-services_lib-mycity')
    compile project(':view-paget-indicator-mycity')
    compile project(':facebook-sdk-mycity')
    compile project(':Android-PullToRefresh-master:extras:PullToRefreshListFragment')
    compile project(':Android-PullToRefresh-master:library')

    }
}

android {

    compileSdkVersion 20
    buildToolsVersion "20.0.0"

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

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

由于

1 个答案:

答案 0 :(得分:1)

尝试在build.gradle之后添加buildToolsVersion这些行:

defaultConfig {
    minSdkVersion 4 //or your minsdk
    targetSdkVersion 19
}

Gradle会覆盖Manifest中的某些值,例如minSdk。 如果未指定此值,则gradle使用值= 1(并且pulltoRefresh库使用minSdk = 4)