首页 \ 问答 \ 在构建Android应用程序时出现gradle错误(Getting gradle error while building android app)

在构建Android应用程序时出现gradle错误(Getting gradle error while building android app)

我在构建Android应用程序时遇到gradle错误。 我收到以下错误:

Error:Execution failed for task ':app:transformClassesWithJarMergingForNVOLVDebug'.

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com / google / myjson / stream / MalformedJsonException.class

任何形式的帮助将受到高度赞赏。

应用程序/ gradle这个

apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'

    useLibrary 'org.apache.http.legacy'

    packagingOptions {
        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'
    }

    defaultConfig {
        applicationId "com.app.iqvis.nvolv_cleanup"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 2
        versionName "2.1"
        multiDexEnabled true
        renderscriptTargetApi 19
        renderscriptSupportModeEnabled true


        ndk {
            abiFilters "armeabi", "armeabi-v7a", "x86", "mips"

        }


    }

    productFlavors {
        NVOLV {
            applicationId "com.app.iqvis.nvolv"
            copy {
                from 'src/main/'
                include '*.json'
                into '.'
            }
            versionCode 51
            versionName "2.0.2"
        }
        ISNA {
            applicationId "com.app.iqvis.isna"
//            manifest.srcFile "isna/AndroidMenifest.xml"
        }
        ARNOVA {
            applicationId "com.app.iqvis.arnova"
        }
        PERISCOPE {
            applicationId "com.app.iqvis.periscope"
        }
        SAN {
            applicationId "com.app.iqvis.sanjosejazz"
        }
        OHIO {
            applicationId 'com.app.iqvis.ohioaeyc'
            copy {
                from 'src/OHIO/'
                include '*.json'
                into '.'
            }
            versionCode 32
            versionName '1.992'
        }
        BeckersHealthCare {
            applicationId 'com.app.iqvis.beckershealthcare'
            copy {
                from 'src/BeckersHealthCare/'
                include '*.json'
                into '.'
            }
            versionCode 32
            versionName '1.91'
        }
        NPCenter {
            applicationId 'com.app.iqvis.npcenter'
            copy {
                from 'src/NPCenter/'
                include '*.json'
                into '.'
            }
            versionCode 32
            versionName '1.7'
        }
        NVOLVDev {
            applicationId "com.app.iqvis.nvolvdev"
            copy {
                from 'src/NVOLVDev/'
                include '*.json'
                into '.'
            }



            versionCode 19
            versionName "2.39"
        }
        WSCPA {
            applicationId "com.app.iqvis.wscpa"
            copy {
                from 'src/WSCPA/'
                include '*.json'
                into '.'
            }
            versionCode 32
            versionName "1.2"
        }
        UMAA {
            applicationId "com.app.iqvis.umaa"
            copy {
                from 'src/UMAA/'
                include '*.json'
                into '.'
            }
            versionCode 32
            versionName "1.1"
        }
        SFDW {
            applicationId "com.app.iqvis.sfdw"
            copy {
                from 'src/SFDW/'
                include '*.json'
                into '.'
            }

            versionCode 3
            versionName "1.96"

        }
        CALCPA {
            applicationId 'com.app.iqvis.calcpa'
            copy {
                from 'src/CALCPA/'
                include '*.json'
                into '.'
            }
            versionCode 2
            versionName '1.1'
        }

    }

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

    dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries = true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

repositories {
    maven { url 'http://repo1.maven.org/maven2' }
    mavenCentral()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile files('libs/zbar.jar')
    compile files('libs/android-volley-master-1.0.15.jar')
    compile files('libs/Branch-1.10.8.jar')
    //    compile files('libs/ormlite-core-4.41.jar')
    compile files('libs/sugar-1.3.jar')
    compile files('libs/google-api-client-1.17.0-rc.jar')
    //    compile files('libs/sinch-android-rtc-3.6.1.jar')
    compile files('libs/google-api-services-urlshortener-v1-rev22-1.17.0-rc.jar')
    compile files('libs/crittercism_v5_3_3_sdkonly.jar')
    //    compile files('libs/httpmime-4.1.3.jar')
    compile files('libs/google-http-client-1.17.0-rc.jar')
    //    compile files('libs/ormlite-android-4.41.jar')
//    compile files('libs/nvolvlib.jar')
    provided files('libs/myjson-2.3.1.jar')
    compile files('libs/google-http-client-android-1.17.0-rc.jar')
    compile files('libs/iqvisanalytics.jar')
    compile files('libs/stickygridheaders.jar')
    compile files('libs/google-api-client-android-1.17.0-rc.jar')
    //    compile files('libs/commSinch.jar')
    compile project(':resideMenu')
    compile project(':library')
    compile project(':nvolvlib')
    compile project(':extensiblepageindicator')
    compile project(':ahbottomnavigation')
    compile project(':commSinch')
    compile project(':fab')
    compile files('libs/gentlyWEB-utils-1.1.jar')
    compile files('libs/JoSQL-2.2.jar')

//    compile 'com.android.support:recyclerview-v7:23.0.0'
//    compile 'com.android.support:cardview-v7:23.0.0'


    compile'joda-time:joda-time:2.7'
    compile'com.google.android.gms:play-services:8.4.0'
    compile'com.squareup.picasso:picasso:2.5.2'
    compile'me.leolin:ShortcutBadger:1.1.3@aar'
    compile'com.parse.bolts:bolts-android:1.+'
    compile'com.parse:parse-android:1.+'
    compile 'com.github.traex.rippleeffect:library:1.3'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:design:23.0.0'
    compile 'com.google.android.gms:play-services-identity:8.4.0'
    compile 'com.android.support:recyclerview-v7:23.0.0'
    compile 'com.android.support:cardview-v7:23.0.0'
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile 'com.roughike:bottom-bar:1.2.1'
    compile 'com.google.guava:guava:19.0'
    compile 'com.ms-square:expandableTextView:0.1.4'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
}

nvolvlib gradle文件:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile files('libs/httpmime-4.1.3.jar')
    compile files('libs/ormlite-core-4.43.jar')
    compile files('libs/ormlite-android-4.43.jar')
    compile files('libs/myjson-2.3.1.jar')

}


I am getting gradle error while building android app. I am getting following error:

Error:Execution failed for task ':app:transformClassesWithJarMergingForNVOLVDebug'.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/myjson/stream/MalformedJsonException.class

Any kind of help would be highly appreciated.

app/gradle

apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'

    useLibrary 'org.apache.http.legacy'

    packagingOptions {
        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'
    }

    defaultConfig {
        applicationId "com.app.iqvis.nvolv_cleanup"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 2
        versionName "2.1"
        multiDexEnabled true
        renderscriptTargetApi 19
        renderscriptSupportModeEnabled true


        ndk {
            abiFilters "armeabi", "armeabi-v7a", "x86", "mips"

        }


    }

    productFlavors {
        NVOLV {
            applicationId "com.app.iqvis.nvolv"
            copy {
                from 'src/main/'
                include '*.json'
                into '.'
            }
            versionCode 51
            versionName "2.0.2"
        }
        ISNA {
            applicationId "com.app.iqvis.isna"
//            manifest.srcFile "isna/AndroidMenifest.xml"
        }
        ARNOVA {
            applicationId "com.app.iqvis.arnova"
        }
        PERISCOPE {
            applicationId "com.app.iqvis.periscope"
        }
        SAN {
            applicationId "com.app.iqvis.sanjosejazz"
        }
        OHIO {
            applicationId 'com.app.iqvis.ohioaeyc'
            copy {
                from 'src/OHIO/'
                include '*.json'
                into '.'
            }
            versionCode 32
            versionName '1.992'
        }
        BeckersHealthCare {
            applicationId 'com.app.iqvis.beckershealthcare'
            copy {
                from 'src/BeckersHealthCare/'
                include '*.json'
                into '.'
            }
            versionCode 32
            versionName '1.91'
        }
        NPCenter {
            applicationId 'com.app.iqvis.npcenter'
            copy {
                from 'src/NPCenter/'
                include '*.json'
                into '.'
            }
            versionCode 32
            versionName '1.7'
        }
        NVOLVDev {
            applicationId "com.app.iqvis.nvolvdev"
            copy {
                from 'src/NVOLVDev/'
                include '*.json'
                into '.'
            }



            versionCode 19
            versionName "2.39"
        }
        WSCPA {
            applicationId "com.app.iqvis.wscpa"
            copy {
                from 'src/WSCPA/'
                include '*.json'
                into '.'
            }
            versionCode 32
            versionName "1.2"
        }
        UMAA {
            applicationId "com.app.iqvis.umaa"
            copy {
                from 'src/UMAA/'
                include '*.json'
                into '.'
            }
            versionCode 32
            versionName "1.1"
        }
        SFDW {
            applicationId "com.app.iqvis.sfdw"
            copy {
                from 'src/SFDW/'
                include '*.json'
                into '.'
            }

            versionCode 3
            versionName "1.96"

        }
        CALCPA {
            applicationId 'com.app.iqvis.calcpa'
            copy {
                from 'src/CALCPA/'
                include '*.json'
                into '.'
            }
            versionCode 2
            versionName '1.1'
        }

    }

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

    dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries = true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

repositories {
    maven { url 'http://repo1.maven.org/maven2' }
    mavenCentral()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile files('libs/zbar.jar')
    compile files('libs/android-volley-master-1.0.15.jar')
    compile files('libs/Branch-1.10.8.jar')
    //    compile files('libs/ormlite-core-4.41.jar')
    compile files('libs/sugar-1.3.jar')
    compile files('libs/google-api-client-1.17.0-rc.jar')
    //    compile files('libs/sinch-android-rtc-3.6.1.jar')
    compile files('libs/google-api-services-urlshortener-v1-rev22-1.17.0-rc.jar')
    compile files('libs/crittercism_v5_3_3_sdkonly.jar')
    //    compile files('libs/httpmime-4.1.3.jar')
    compile files('libs/google-http-client-1.17.0-rc.jar')
    //    compile files('libs/ormlite-android-4.41.jar')
//    compile files('libs/nvolvlib.jar')
    provided files('libs/myjson-2.3.1.jar')
    compile files('libs/google-http-client-android-1.17.0-rc.jar')
    compile files('libs/iqvisanalytics.jar')
    compile files('libs/stickygridheaders.jar')
    compile files('libs/google-api-client-android-1.17.0-rc.jar')
    //    compile files('libs/commSinch.jar')
    compile project(':resideMenu')
    compile project(':library')
    compile project(':nvolvlib')
    compile project(':extensiblepageindicator')
    compile project(':ahbottomnavigation')
    compile project(':commSinch')
    compile project(':fab')
    compile files('libs/gentlyWEB-utils-1.1.jar')
    compile files('libs/JoSQL-2.2.jar')

//    compile 'com.android.support:recyclerview-v7:23.0.0'
//    compile 'com.android.support:cardview-v7:23.0.0'


    compile'joda-time:joda-time:2.7'
    compile'com.google.android.gms:play-services:8.4.0'
    compile'com.squareup.picasso:picasso:2.5.2'
    compile'me.leolin:ShortcutBadger:1.1.3@aar'
    compile'com.parse.bolts:bolts-android:1.+'
    compile'com.parse:parse-android:1.+'
    compile 'com.github.traex.rippleeffect:library:1.3'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:design:23.0.0'
    compile 'com.google.android.gms:play-services-identity:8.4.0'
    compile 'com.android.support:recyclerview-v7:23.0.0'
    compile 'com.android.support:cardview-v7:23.0.0'
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile 'com.roughike:bottom-bar:1.2.1'
    compile 'com.google.guava:guava:19.0'
    compile 'com.ms-square:expandableTextView:0.1.4'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
}

nvolvlib gradle file:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile files('libs/httpmime-4.1.3.jar')
    compile files('libs/ormlite-core-4.43.jar')
    compile files('libs/ormlite-android-4.43.jar')
    compile files('libs/myjson-2.3.1.jar')

}

原文:https://stackoverflow.com/questions/39847868
更新时间:2023-08-28 14:08

最满意答案

我已经改变了你的语法 - http://jsfiddle.net/w25mQ/4/

if( $('#menu').width === 150 )....

$(this).animate....

评论者是对的,你应该结合你的点击处理程序,像这样 - http://jsfiddle.net/w25mQ/5/


I have made a change to your syntax - http://jsfiddle.net/w25mQ/4/

if( $('#menu').width === 150 )....

and

$(this).animate....

The commenter is right though, you should combine your click handlers, like this - http://jsfiddle.net/w25mQ/5/

相关问答

更多
  • 首先需要将事件处理程序定义为单独的(命名)函数: function myMouseWheelHandler(e) { if (e.target.id == 'el') return; e.preventDefault(); e.stopPropagation(); $(this).css({ "overflow-y": "scroll", "position": "fixed", "width": "100%" }); }; 然后保留你拥有的.on() ,但现在使用你的命名 ...
  • jQuery规范化了这个,你可以可靠地调用.preventDefault() ,如下所示: $("#admin_main").delegate("#create_user_form", "submit", function (event) { event.preventDefault(); $.post('create_user', $("#create_user_form").serialize(), function (data) { $("#admin_main").html(data ...
  • 该事件需要传递给该函数。 该函数需要两个参数,但它只传递一个参数。 OnClientClick = "return EmpDelete(e," + e.Row.Cells[iFNmae].Text + ");" 完整来源 protected void gv_RowDataBound(object sender, GridViewRowEventArgs e) { e.Row.Cells[iDelete].Controls.Add (new ImageButton ...
  • 你可以尝试这样做: 为div设置属性tabindex #divQuickCartDialog :
    ...
    CSS仅用于样式,将outline设置为0: #divQuickCartDialog { outline:0; height:100%; width:100%; } 然后通过以下方式替换文档click和touchstart处理程序: $("#divQuickCart ...
  • 在什么情况下我们可以使用preventDefault()? 实际上,任何类型的事件都可以通过preventDefault();来停止它的默认行为preventDefault(); 因此,不仅要提交按钮,还要按下按钮,滚动事件,并为其命名,并且可以防止它发生。 或者,如果您想将自己的逻辑添加到默认行为中,请考虑记录事件或您选择的任何内容。 2.如何查找所有浏览器的默认行为? 比如,如果我点击一个按钮,浏览器的默认行为是什么? 这是什么意思? 大多数默认行为都是暗含的。 当你点击一个按钮时,onclick事件触 ...
  • 我已经改变了你的语法 - http://jsfiddle.net/w25mQ/4/ if( $('#menu').width === 150 ).... 和 $(this).animate.... 评论者是对的,你应该结合你的点击处理程序,像这样 - http://jsfiddle.net/w25mQ/5/ I have made a change to your syntax - http://jsfiddle.net/w25mQ/4/ if( $('#menu').width === 150 ).. ...
  • 只要代码中没有出现任何问题,在何处调用preventDefault无关紧要。 如果将它放在代码中,它将阻止默认操作,即使脚本进一步崩溃。 如果你把它放在代码的最后,它只会阻止默认操作,如果脚本在途中没有崩溃。 As long as nothing goes wrong in the code, it doesn't matter where you call preventDefault. If you put it first in the code, it will prevent the defaul ...
  • 你的问题是; 获取ajax请求后的错误div与移动浏览器中的表单重叠,如下图所示。 您可以使用; margin-top:20px; 为你的错误div。 解决之后,只需使用 return false; 代替 e.preventDefault(); beacuse移动浏览器没有点击事件。 你需要使用touchstart或touchend。 完整代码 $("#formRegister").submit(function (e) { var code = $('#Code').val(); v ...
  • $('#plus25').on('click', function(e) { var id = $('#selectChoice option:selected').attr('id'), $target = $('#'+ id +'Item'); $target.html(function(i, value) { var currentWidth = parseInt(value, 10), newWidth = currentWi ...
  • 模糊实现 您的代码可以防止selectChoice的默认值,但不能用于单击! 当通过鼠标或键盘选择选项时,自动完成对象会在input元素上触发selectChoice。 它不会弄乱click事件。 如果您不想要浏览器默认click事件,那么为什么要使用 ? 替代实施建议 你可以像这样制作一个自动完成模板: {% for video in video_qs %} {{ vi ...

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)