标签:
在调试程序的时候,出现这个错误:
Error:Error converting bytecode to dex:
Cause: java.lang.RuntimeException: Exception parsing classes
Error:Execution failed for task ‘:artandroidclient:transformClassesWithDexForAviterichDebug’.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘C:\Program Files\Java\jdk1.8.0_66\bin\java.exe” finished with non-zero exit value 1
When i looked through the output of the gradle console
I scrolled close to the end of the exception. There is a part in that long exception line that actually mentions the cause:
AGPBI: { "kind":"error","text":"Error converting bytecode to dex: \n Cause: java.lang.RuntimeException: Exception parsing classes","sources":[{}],"original":"UNEXPECTED TOP-LEVEL EXCEPTION:\njava.lang.RuntimeException: Exception parsing classes\n\tat
...
com.android.dx.command.Main.main(Main.java:106)\nCaused by: com.android.dx.cf.iface.ParseException: class name (cn/hdnc/ArtSDK/BuildConfig) does not match path (cn/hdnc/artsdk/BuildConfig.class)\n\tat
...}
AGPBI: {"kind":"error","text":"1 error; aborting","sources":[{}]}
This way i found out where to search for missmatching package names/paths.
app/build/source/BuildConfig/Build Varients/package name/BuildConfig中的package name和项目中的包名不一致。
我之所以会出现包名不一致,是因为手动修改包名,忘记修改 manifest.xml文件,下面提供两种修改包名的方法:
手动修改包名需要修改两个地方:
package=" "
节点
图二
点击图二所示的图标,然后会出现2所示菜单,这个时候注意方框圈住的选项,默认是选中状态,我们把它取消,中间的空包名就会展开。
我们就可以随意的修改包名了,选中想要修改的包名部分目录,Shift + F6 ,在弹出框选择Rename Package,稍等一会,可以看到包名已经发生了变化。OK,下图为我把包名test部分改为rename.
参考:android studio如何修改包名
但是作者没有理解ApplicationId 与 PackageName的关系
Error converting bytecode to dex: Cause: java.lang.RuntimeException: Exception parsing classes
标签:
原文地址:http://blog.csdn.net/xx326664162/article/details/51859106