加入ViewPagerIndicator到Android工作室工作室、ViewPagerIndicator、Android

由网友(你若不惜,我亦不爱)分享简介:我试图让杰克沃顿商学院的ViewPagerIndicator与Android工作室工作,但不幸的是它不会起作用。 我下载了的.aar文件,这里并把它列入我的libs文件夹中。 我引用的是这样的: 编译文件(钢骨混凝土/主/库/ viewpagerindicator_2.4.1.aar)Android的工作室给了我以...

我试图让杰克沃顿商学院的ViewPagerIndicator与Android工作室工作,但不幸的是它不会起作用。 我下载了的.aar文件,这里并把它列入我的libs文件夹中。 我引用的是这样的:

 编译文件(钢骨混凝土/主/库/ viewpagerindicator_2.4.1.aar)
 

Android的工作室给了我以下错误:

 错误:在APK包装重复文件
 

我不是很熟悉的摇篮,不知道该怎么办时,它给了我这个错误。 能否请你帮我这个吗?

Android studio怎么创建一个activity文件

下面是我的完整build.gradle:

 应用插件:com.android.application

安卓{
    compileSdkVersion 19
    buildToolsVersion20.0.0

    defaultConfig {
        的applicationIDde.xxx
        的minSdkVersion 15
        targetSdkVersion 19
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }

    buildTypes {
     推出 {
     runProguard假
     proguardFiles getDefaultProguardFile('ProGuard的-android.txt'),'ProGuard的-rules.txt
    }
    }
}

依赖{
    编译com.android.support:support-v4:20.0.0
    编译com.github.amlcurran.showcaseview:图书馆:5.0.0
    编译文件(钢骨混凝土/主/库/ PdfViewer.jar)
    编译文件(钢骨混凝土/主/库/ viewpagerindicator_2.4.1.aar)
}
 

解决方案

更新

根据通过的Jürgen'Kashban'Wahlmann 的href="http://stackoverflow.com/a/26138635/1525990">答案给出的项目结构 - >添加(+号) - >导入现有项目。进口只是被称为库的文件夹,而不是整个项目(离开导入选项成为Android Studio的建议)。

#3如果您build.gradle规定的compileSdkVersion不与在Android-ViewPagerIndicator项目中指定的匹配,可以改变第二个。同样适用与任何其他财产,如的minSdkVersion,甚至目前的支持库。

#4加入Android的ViewPagerIndicator项目作为依赖于你的build.gradle模块:

 相关性{
    编制项目(':库)
}
 

#5同步项目摇篮文件。

i'm trying to get Jake Wharton's ViewPagerIndicator working with Android Studio but unfortunately it won't work. I downloaded the .aar file from here and included it in my libs folder. I referenced it like this:

compile files('src/main/libs/viewpagerindicator_2.4.1.aar')

Android Studio gives me the following error:

Error:duplicate files during packaging of APK

I'm not very familiar with gradle and don't know what to do when it gives me this error. Can you please help me with this one?

Here's my complete build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "de.xxx"
        minSdkVersion 15
        targetSdkVersion 19
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }

    buildTypes {
     release {
     runProguard false
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
    }
}

dependencies {
    compile 'com.android.support:support-v4:20.0.0'
    compile 'com.github.amlcurran.showcaseview:library:5.0.0'
    compile files('src/main/libs/PdfViewer.jar')
    compile files('src/main/libs/viewpagerindicator_2.4.1.aar')
}

解决方案

UPDATE

Based on the answer given by Jürgen 'Kashban' Wahlmann, it is now possible to add ViewPagerIndicator via gradle:

Top Level Build.gradle:

buildscript {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'
    }
}

allprojects {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }
        mavenCentral()
    }
}

App's build.gradle:

compile 'com.viewpagerindicator:library:2.4.1@aar'

------------

To use Android-ViewPagerIndicator in Android Studio, you can’t download it from gradle. Instead, you must import the library as an "Existing Project" to your current one.

Follow these steps:

#1 Download source code from GitHub.

#2 In your Android Studio Project: File -> Project Structure -> add (+ symbol) -> Import Existing Project. Import just the folder called "library", not the entire project (leave the import options as Android Studio suggests).

# 3 If the "compileSdkVersion" specified in your build.gradle doesn’t match with the one specified in the Android-ViewPagerIndicator project, change the second one. The same apply with any other property, such as "minSdkVersion" or even the current support library.

# 4 Add Android-ViewPagerIndicator project as a dependency to your build.gradle module:

dependencies {
    compile project(':library')
}

# 5 Sync project with gradle files.

阅读全文

相关推荐

最新文章