摇篮:执行失败的任务 [英] Gradle: Execution Failed For Task

查看:169
本文介绍了摇篮:执行失败的任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我只是试着做Android的布局选项卡可滑动的示例程序。我在lib文件夹添加Android的支持库。我加在应用程序兼容性V4和V7。从那以后,我与点击的gradle文件同步的项目。然后我进入code,那么一切都和我发现,在code没有错误,但是当我尝试运行该程序的显示我这个错误

Hi I just tried to do a example program of Android Tab Layout With Swipe. I added android support libraries in the lib folder. I added appcompat v4 and v7 in that. After that I clicked sync project with gradle files. Then I entered code then everything went and I found no error in code but when I try to run the program its showing me this error

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/annotation/ArrayRes.class

和我的build.gradle文件中包含该

And my build.gradle file contains this

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.example.eugene.swipeabletablayout"
    minSdkVersion 15
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
}

在我的code是没有问题的,但我不知道为什么我收到此错误。

In my code there is no problem but I don't know why I am getting this error.

我试图寻找这个问题的SOF,但我没有找到任何答案。

I tried to search for this issue in SOF but I didn't find any answer.

推荐答案

从库目录中删除Android的支持库。由于使用gradle这个并表示与编译依赖应用程序兼容性-V7 您不必手动包括JAR文件。这导致在制作的时候重复的符号冲突。将其列为一个编译依赖将导致gradle这个Maven的合作,拉自动的lib(和它的依赖。)

Remove the Android support libraries from the libs directory. Since you are using gradle and have indicated a compile dependency with appcompat-v7 you do not need to include the JARs manually. This is causing a conflict at build time with duplicate symbols. Listing it as a compile dependency will cause gradle to work with Maven to pull the lib automatically (and its dependencies.)

这篇关于摇篮:执行失败的任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆