pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

將字節碼轉換為 dex 時出錯:原因:java.lang.RuntimeE

Error converting bytecode to dex: Cause: java.lang.RuntimeException: Exception parsing classes - Android studio 2.0 beta 6(將字節碼轉換為 dex 時出錯:原因:java.lang.RuntimeException:異常解析類 - Android Studio 2.0 beta 6) - I
本文介紹了將字節碼轉換為 dex 時出錯:原因:java.lang.RuntimeException:異常解析類 - Android Studio 2.0 beta 6的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我用 gradle 更新到了最新版本的 Android studio 2.0 Beta 6:

I updated to the last version of Android studio 2.0 Beta 6 with the gradle :

dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0-beta6'
}

該應用在我測試過的所有東西的模擬器和設備上運行良好.

The app works perfectly fine on emulator and devices I tested every thing and it works fine.

我只有在嘗試生成簽名的 APK 時遇到了很多錯誤,

I got many errors only when I try to Generate Signed APK,

我在依賴項中遇到了一些錯誤,當我排除矢量繪圖、矢量動畫繪圖和 Support-v4 庫時,所有這些錯誤都解決了

I got some errors in dependencies, all of them solved when i excluded vector drawable, vector animate drawable and Support-v4 library

現在我沒有任何依賴錯誤.

Now i dont have any dependencies error.

現在我的 app 模塊的 gradle.build 看起來像這樣:

now my gradle.build for the app module looks like this:

apply plugin: 'com.android.application'

android {
    configurations {
        //all*.exclude group: 'com.android.support', module: 'support-v4'
        all*.exclude module: 'animated-vector-drawable'
        all*.exclude module: 'support-vector-drawable'
        //all*.exclude module: 'support-v4'

    }
    repositories {
        maven { url "https://jitpack.io" }

    }
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
    defaultConfig {
        applicationId "com.test.test"
        minSdkVersion 11
        targetSdkVersion 23
        versionCode 1
        versionName "1"

//        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile('com.github.afollestad.material-dialogs:commons:0.8.5.5@aar') {
        transitive = true
        exclude module: 'support-v4'
        exclude module: 'appcompat-v7'
        exclude module: 'recyclerview-v7'
    }
    compile('com.google.android.gms:play-services-ads:8.4.0') {
        exclude module: 'support-v4'
    }
    compile('com.google.android.gms:play-services-analytics:8.4.0') {
        exclude module: 'support-v4'
    }
    compile('com.android.support:appcompat-v7:23.2.0') {
        exclude module: 'support-v4'
        exclude module: 'animated-vector-drawable'
        exclude module: 'support-vector-drawable'
    }
    compile('com.android.support:support-v4:23.2.0') {
        exclude module: 'animated-vector-drawable'
        exclude module: 'support-vector-drawable'
    }
    compile('com.android.support:palette-v7:23.2.0') {
        exclude module: 'support-v4'
    }
    compile('com.android.support:cardview-v7:23.2.0') {
        exclude module: 'support-v4'
    }
    compile('com.android.support:recyclerview-v7:23.2.0') {
        exclude module: 'support-v4'
    }
    compile('com.android.support:design:23.2.0') {
        exclude module: 'support-v4'
    }
    compile('com.nineoldandroids:library:2.4.0') {
        exclude module: 'support-v4'
    }
    compile('com.baoyz.swipemenulistview:library:1.2.1') {
        exclude module: 'support-v4'
        exclude module: 'appcompat-v7'
        exclude module: 'recyclerview-v7'
    }
    compile('com.squareup.picasso:picasso:2.5.2') {
        exclude module: 'support-v4'
    }
    compile('com.nononsenseapps:filepicker:2.5.0') {
        exclude module: 'support-v4'
        exclude module: 'appcompat-v7'
        exclude module: 'recyclerview-v7'

    }
    compile 'com.google.code.gson:gson:2.6.1'
}

只有在我為發布而構建時才會出現錯誤:

The errors shows up only when I build for release:

這是我打開multiDex時的錯誤:

This is the error when i turn on multiDex:

Error:Execution failed for task ':app:transformClassesWithMultidexlistForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

這是我關閉它時的錯誤:

And this is the error when i turn it off:

:app:transformClassesWithDexForRelease
Error:Error converting bytecode to dex:
Cause: java.lang.RuntimeException: Exception parsing classes

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

> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

我嘗試將 buildToolsVersion '23.0.2' 更改為所有可能的版本,但沒有任何改變.

I tried to change the buildToolsVersion '23.0.2' to every possible version and nothing changed.

當我輸入 22.0.1 版本時出現此錯誤:

when i put the version 22.0.1 i got this error:

Error:Error converting bytecode to dex:
Cause: com.android.dx.cf.iface.ParseException: name already added: string{"a"}

Error:Execution failed for task ':app:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

我嘗試了所有可能的支持庫版本和相同的結果.

I tried with all possible support libraries version and same result.

我嘗試使用 Java 1.6 和 1.7,但沒有任何改變!

I tried with Java 1.6 and 1.7 and nothing has changed !

請問還有什么其他可能的解決方案?

what can be other possible solution please ?

推薦答案

我也遇到了同樣的錯誤,我正在搜索許多具有重復依賴項或 multidex 等的現有答案,但沒有一個有效.(Android studio 2.0 Beta 6,構建工具 23.0.2,無 multidex)

I also faced the same error, and i was searching through many existing answers with duplicate dependencies or multidex etc. but none worked. (Android studio 2.0 Beta 6, Build tools 23.0.2, no multidex)

原來我曾經使用的包名與清單中描述的包名不匹配.

It turned out that i once used a package names which didn't match the package name that is depicted in the Manifest.

在其他 ParseException 行中,我發現我在不同模塊中有文件,這些文件具有相似的包名稱/路徑,可能會與 dexer 發生沖突.

In other ParseException lines, i found out that i had files in different modules whith similiar package names/paths that possibly conflicted the dexer.

示例:

模塊 A:com.example.xyz.ticketing.modulea.Interface.java

模塊 B:com.example.Xyz.ticketing.moduleb.Enumerations.java

模塊 C:依賴于 A 和 B

Module C: Has dependencies on A and B

將Xyz"修復為小寫后,dexer 又正常了.

After fixing "Xyz" to lowercase, the dexer was fine again.

如何找出:

當我查看 gradle 控制臺的輸出時,ParseExceptions 看起來像這樣:

When i looked through the output of the gradle console for the ParseExceptions that looks like this:

AGPBI: {"kind":"error","text":"將字節碼轉換為 dex 時出錯: 原因:java.lang.RuntimeException: 異常解析類"

AGPBI: {"kind":"error","text":"Error converting bytecode to dex: Cause: java.lang.RuntimeException: Exception parsing classes"

我滾動到接近異常的末尾.在那長長的異常行中有一部分實際上提到了原因:

I scrolled close to the end of the exception. There is a part in that long exception line that actually mentions the cause:

引起:com.android.dx.cf.iface.ParseException:類名(at/dummycompany/mFGM/hata/hwp/BuildConfig)與路徑不匹配(at/dummycompany/mfgm/hata/hwp/BuildConfig.class)

這樣我找到了在哪里搜索不匹配的包名稱/路徑

This way i found out where to search for missmatching package names/paths

這篇關于將字節碼轉換為 dex 時出錯:原因:java.lang.RuntimeException:異常解析類 - Android Studio 2.0 beta 6的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現 IncompatibleClassChangeError)
How to get current flavor in gradle(如何在 gradle 中獲取當前風味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復“意外元素lt;查詢gt;在“清單中找到錯誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風味庫的多風味應用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運行時有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
主站蜘蛛池模板: 深圳南财多媒体有限公司介绍 | 首页_欧瑞传动官方网站--主营变频器、伺服系统、新能源、软起动器、PLC、HMI | 宿舍管理系统_智慧园区系统_房屋/房产管理系统_公寓管理系统 | 中央空调温控器_风机盘管温控器_智能_液晶_三速开关面板-中央空调温控器厂家 | 网站优化公司_SEO优化_北京关键词百度快速排名-智恒博网络 | 庭院灯_太阳能景观灯_草坪灯厂家_仿古壁灯-重庆恒投科技 | 铣刨料沥青破碎机-沥青再生料设备-RAP热再生混合料破碎筛分设备 -江苏锡宝重工 | 棕刚玉_白刚玉_铝酸钙-锐石新材料 | 洛阳防爆合格证办理-洛阳防爆认证机构-洛阳申请国家防爆合格证-洛阳本安防爆认证代办-洛阳沪南抚防爆电气技术服务有限公司 | 设计圈 - 让设计更有价值!| 雄松华章(广州华章MBA)官网-专注MBA/MPA/MPAcc/MEM辅导培训 | 今日扫码_溯源二维码_产品防伪一物一码_红包墙营销方案 | 中视电广_短视频拍摄_短视频推广_短视频代运营_宣传片拍摄_影视广告制作_中视电广 | 道达尔润滑油-食品级润滑油-道达尔导热油-合成导热油,深圳道达尔代理商合-深圳浩方正大官网 | 礼仪庆典公司,礼仪策划公司,庆典公司,演出公司,演艺公司,年会酒会,生日寿宴,动工仪式,开工仪式,奠基典礼,商务会议,竣工落成,乔迁揭牌,签约启动-东莞市开门红文化传媒有限公司 | 造价工程师网,考试时间查询,报名入口信息-网站首页 | 橡胶粉碎机_橡胶磨粉机_轮胎粉碎机_轮胎磨粉机-河南鼎聚重工机械制造有限公司 | 桂林腻子粉_内墙外墙抗裂砂浆腻子粉推荐广西鑫达涂料厂家供应 | 东莞韩创-专业绝缘骨架|马达塑胶零件|塑胶电机配件|塑封电机骨架厂家 | 仓储货架_南京货架_钢制托盘_仓储笼_隔离网_环球零件盒_诺力液压车_货架-南京一品仓储设备制造公司 | 风淋室生产厂家报价_传递窗|送风口|臭氧机|FFU-山东盛之源净化设备 | 桂林腻子粉_内墙外墙抗裂砂浆腻子粉推荐广西鑫达涂料厂家供应 | 振动台-振动试验台-振动冲击台-广东剑乔试验设备有限公司 | 深圳标识制作公司-标识标牌厂家-深圳广告标识制作-玟璟广告-深圳市玟璟广告有限公司 | 深圳办公室装修,办公楼/写字楼装修设计,一级资质 - ADD写艺 | led太阳能路灯厂家价格_风光互补庭院灯_农村市政工程路灯-中山华可路灯品牌 | 微波消解仪器_智能微波消解仪报价_高压微波消解仪厂家_那艾 | 防水套管厂家_刚性防水套管_柔性防水套管_不锈钢防水套管-郑州中泰管道 | 金现代信息产业股份有限公司--数字化解决方案供应商 | 专业的压球机生产线及解决方案厂家-河南腾达机械厂 | 广州工业氧气-工业氩气-工业氮气-二氧化碳-广州市番禺区得力气体经营部 | Eiafans.com_环评爱好者 环评网|环评论坛|环评报告公示网|竣工环保验收公示网|环保验收报告公示网|环保自主验收公示|环评公示网|环保公示网|注册环评工程师|环境影响评价|环评师|规划环评|环评报告|环评考试网|环评论坛 - Powered by Discuz! | 浇钢砖,流钢砖_厂家价低-淄博恒森耐火材料有限公司 | 武汉不干胶印刷_标签设计印刷_不干胶标签印刷厂 - 武汉不干胶标签印刷厂家 | 吹塑加工_大型吹塑加工_滚塑代加工-莱力奇吹塑加工有限公司 | 彼得逊采泥器-定深式采泥器-电动土壤采样器-土壤样品风干机-常州索奥仪器制造有限公司 | 细沙回收机-尾矿干排脱水筛设备-泥石分离机-建筑垃圾分拣机厂家-青州冠诚重工机械有限公司 | 流水线电子称-钰恒-上下限报警电子秤-上海宿衡实业有限公司 | 新中天检测有限公司青岛分公司-山东|菏泽|济南|潍坊|泰安防雷检测验收 | 大连海岛旅游网>>大连旅游,大连海岛游,旅游景点攻略,海岛旅游官网 | 仿真植物|仿真树|仿真花|假树|植物墙 - 广州天昆仿真植物有限公司 |