AndroidStudio build.gradle 报错

Android Studio. I‘m getting this kind of error during application run.

Error:Execution failed for task ‘:app:packageDebug‘. Duplicate files copied in APK META-INF/notice.txt

build.gradle

apply plugin: ‘android‘

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

    packagingOptions {
        exclude ‘META-INF/DEPENDENCIES‘
        exclude ‘META-INF/NOTICE‘
        exclude ‘META-INF/LICENSE‘
        exclude ‘META-INF/LICENSE.txt‘
        exclude ‘META-INF/NOTICE.txt‘
        exclude ‘META-INF/ASL2.0‘
    }

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile(‘proguard-android.txt‘), ‘proguard-rules.txt‘
        }
    }
}

dependencies {
    compile ‘com.android.support:appcompat-v7:19.0.1‘
    compile ‘com.j256.ormlite:ormlite-android:4.48‘
    compile ‘org.codehaus.jackson:jackson-core-asl:1.9.13‘
    compile ‘org.codehaus.jackson:jackson-mapper-asl:1.9.13‘
    compile ‘com.octo.android.robospice:robospice:1.4.11‘
    compile ‘com.octo.android.robospice:robospice-spring-android:1.4.11‘
}

How can I fix this error?

EDITED

These exclude options solved my problem:

packagingOptions {
        exclude ‘META-INF/DEPENDENCIES‘
        exclude ‘META-INF/LICENSE‘
        exclude ‘META-INF/LICENSE.txt‘
        exclude ‘META-INF/license.txt‘
        exclude ‘META-INF/NOTICE‘
        exclude ‘META-INF/NOTICE.txt‘
        exclude ‘META-INF/notice.txt‘
        exclude ‘META-INF/ASL2.0‘
    }
时间: 2024-08-06 07:56:49

AndroidStudio build.gradle 报错的相关文章

ionic2踩坑之ionic build android报错

自己项目一直跑的好好好好的,build还是run都没问题,今天忽然一个小伙伴build一直报错.\ 错误如下: Error occurred during initialization of VMCould not reserve enough space for 2097152KB object heap 第一反应是java虚拟机内存不够,然后按网上的新建环境变量 变量名:_JAVA_OPTIONS 变量值:-Xmx512M 然并卵,问题并没有得到解决,最后在一个国外网站上找到了问题原因. 原

Android编译时gradle报错乱码

问题是这样的,代码中有中文,中文是在注释中,显示的时候是完全正常的,然而编译的时候gradle会报错.提示信息其实也是乱码的. 编译时Gradle报错信息 “编码 UTF-8 的不可映射字符” 首先在设置中设置字符集, Settings->File Encodings->IDE Encodeing->UTF-8 Settings->File Encodings->Project Encodeing->UTF-8 如果这样不行的话继续往下看,如果可以了的话下面的步骤忽略就

Ubuntu下build wxPython报错

Ubuntu下build wxPython报错configure: error: GStreamer not available 百度到如下页面http://wxpython-users.1045709.n5.nabble.com/Linux-configure-fails-on-GStreamer-td3271417.html 执行如下命令后正常 sudo apt install  python-gst0.10-dev 结果虽然用"./configure && make &am

angular2 ng build --prod 报错:Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory'

调试页面 ng serve 正常 ng build 也正常 ng build --prod 异常:Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' 开始以为是以前那样,引用错了路径或少引用了东西. 搜了好多资料,发现是 angular-cli 的版本有点低了(因为用了最新的material) 找到原因了,问题就很容易解决了 第一步: rm -rf node_modules/ 第二部: npm

关于android studio Gradle报错

今天android studio跑项目,build了一下,始终跑不起,把gradle和android studio都更新了一下,还是不行, 一直报这个错误 UnsupportedMethodException          Failed to set up Android modules in project 'Project': Unsupported method: SourceProvider.getJniDirectories().          The version of G

Android Gradle报错 (Error:No such property: GradleVersion for class: JetGradlePlugin) 的原因与解决

Error:No such property: GradleVersion for class: JetGradlePlugin 错误原因:IDE 版本(GradlePlugin)和 Gradle 版本不匹配导致这个错误. GradlePlugin 版本和 AndroidStudio 版本一致,与 Gradle 版本有一张对应表.在文章末尾. 作为一个 Android 开发人员,平时都要和 Gradle 打交道,却也仅仅是在简单的知道状态.于是很多时候都被其搞得十分难受,这里就来普及一些简单的知

ionic cordova build android 报错 解决

执行 ionic cordova build android 时遇到报错,build时需要安装一些依赖的,所以首先必须联网,另外,这遇到这个错误时npm registry用的是taobao的镜像:https://registry.npm.taobao.org/, 然后我改为了cnpm镜像 :http://r.cnpmjs.org/,再次执行ionic cordova build android成功了.推荐安装nrm,用nrm来进行npm registry的管理,简单方便. 原文地址:https:

android studio 1.0 gradle报错

1. build.gradle里要写classpath 'com.android.tools.build:gradle:1.0.0' 2. 自己下载个gradle2.2.1,studio里手动指定 3. 更新Android SDK Tools到24.0.1 android studio 1.0 对gradle的变化蛮大的,需要不断查资料解决...

Android Studio更新到3.6.0 Gradle报错No cached version of com.android.tools.build:aapt2:3.2.0-alpha16-4748712 available for of...

Top 在更新Android Studio时,突然遇到No cached version of com.android.tools.build:aapt2:3.2.0-alpha18-4804415 available for offline mode.遇到一位大神指点,在Teminal中使用gradlew clean ,gradlew assemble 清理就好了.而且这个assemble命令还可以发现xml中的错误,真是强大. 原文地址:https://www.cnblogs.com/shi