将ViewPagerIndicator添加到项目中

时间:2013-06-22 16:46:17

标签: intellij-idea actionbarsherlock android-studio viewpagerindicator

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

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

根据:

SherlockTestProject

settings.gradle

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

SherlockTest

build.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

build.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

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

} 

1 个答案:

答案 0 :(得分:2)

由于viewpagerindicator使用Maven,我们应该能够像任何maven项目一样包含它。此外,在maven上,他们有一个用于gradle项目的选项卡。 Link to project on maven page

我也开始用这个写一个应用程序,所以我们会看看它是怎么回事。

在build.gradle中,

dependencies{
    ...
    compile 'com.viewpagerindicator:parent:2.4.1'
}