2

一般这样的问题试图在项目中添加ViewPagerIndicator。

Gradle: Execution failed for task ':SherlockTest:dexDebug'. 
> Running D:\Programs\AS\sdk\build-tools\android-4.2.2\dx.bat failed. See output 

取决于:

夏洛克测试项目

设置.gradle

include ':SherlockTest' 
include ':libraries:ViewPagerIndicator' 
include ':libraries:ActionBarSherlock' 

夏洛克测试

构建.grandle

buildscript { 
    repositories { 
        maven { url 'http://repo1.maven.org/maven2' } 
    } 
    dependencies { 
        classpath 'com.android.tools.build:gradle:0.4' 
    } 
} 
apply plugin: 'android' 

dependencies { 
    compile project(':libraries:ActionBarSherlock') 
    compile project(':libraries:ViewPagerIndicator') 

} 

android { 
    compileSdkVersion 17 
    buildToolsVersion "17.0.0" 

    defaultConfig { 
        minSdkVersion 7 
        targetSdkVersion 16 
    } 
} 

库\ActionBarSherlock

构建.grandle

buildscript { 
    repositories { 
        mavenCentral() 
    } 
    dependencies { 
        classpath 'com.android.tools.build:gradle:0.4' 
    } 
} 
apply plugin: 'android-library' 

dependencies { 
    compile files('libs/android-support-v4.jar') 
    compile files('libs/android-support-v13.jar') 
} 

android { 
    compileSdkVersion 17 
    buildToolsVersion "17" 

    defaultConfig { 
        minSdkVersion 7 
        targetSdkVersion 16 
    } 


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

} 

库\ViewPagerIndicator

构建.grandle

buildscript { 
    repositories { 
        mavenCentral() 
    } 
    dependencies { 
        classpath 'com.android.tools.build:gradle:0.4' 
    } 
} 
apply plugin: 'android-library' 

dependencies { 
    compile files('libs/android-support-v4.jar') 
    compile files('libs/android-support-v13.jar') 
} 

android { 
    compileSdkVersion 17 
    buildToolsVersion "17" 

    defaultConfig { 
        minSdkVersion 7 
        targetSdkVersion 16 
    } 


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

} 
4

1 回答 1

2

由于 viewpagerindicator 使用 Maven,我们应该能够像任何 maven 项目一样包含它。此外,在 Maven 上,他们有一个用于 gradle 项目的选项卡。链接到 Maven 页面上的项目

我也开始使用它编写一个应用程序,所以我们将看看它是如何进行的。

在您的 build.gradle 中,

dependencies{
    ...
    compile 'com.viewpagerindicator:parent:2.4.1'
}
于 2013-11-12T04:48:26.360 回答