Android工作室意外的顶级异常。解析类时出错

时间:2016-02-02 23:49:17

标签: android android-studio

我知道有很多问题,但他们都没有指出我的错误。我不是在使用Gradle,这是一个很棒的项目。我正在使用Fragments重做1个活动。当我完成并且类中没有错误/ etc - 尝试编译并得到此错误。在它运行和编译之前就好了。我在这个消息中找不到任何指针。有什么建议吗?

Error:Android Dex: [DMD-Android] UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Android Dex: [DMD-Android] java.lang.RuntimeException: Exception parsing classes
Error:Android Dex: [DMD-Android] at com.android.dx.command.dexer.Main.processClass(Main.java:752)
Error:Android Dex: [DMD-Android] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
Error:Android Dex: [DMD-Android] at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
Error:Android Dex: [DMD-Android] at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
Error:Android Dex: [DMD-Android] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:170)
Error:Android Dex: [DMD-Android] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
Error:Android Dex: [DMD-Android] at com.android.dx.command.dexer.Main.processOne(Main.java:672)
Error:Android Dex: [DMD-Android] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:574)
Error:Android Dex: [DMD-Android] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
Error:Android Dex: [DMD-Android] at com.android.dx.command.dexer.Main.run(Main.java:277)
Error:Android Dex: [DMD-Android] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error:Android Dex: [DMD-Android] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Error:Android Dex: [DMD-Android] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Error:Android Dex: [DMD-Android] at java.lang.reflect.Method.invoke(Method.java:498)
Error:Android Dex: [DMD-Android] at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:161)
Error:Android Dex: [DMD-Android] at org.jetbrains.android.compiler.tools.AndroidDxRunner.main(AndroidDxRunner.java:294)
Error:Android Dex: [DMD-Android] at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:130)
Error:Android Dex: [DMD-Android] Caused by: com.android.dx.cf.iface.ParseException: InvokeDynamic not supported
Error:Android Dex: [DMD-Android] at com.android.dx.cf.cst.ConstantPoolParser.determineOffsets(ConstantPoolParser.java:226)
Error:Android Dex: [DMD-Android] at com.android.dx.cf.cst.ConstantPoolParser.parse(ConstantPoolParser.java:132)
Error:Android Dex: [DMD-Android] at com.android.dx.cf.cst.ConstantPoolParser.parseIfNecessary(ConstantPoolParser.java:124)
Error:Android Dex: [DMD-Android] at com.android.dx.cf.cst.ConstantPoolParser.getPool(ConstantPoolParser.java:115)
Error:Android Dex: [DMD-Android] at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:482)
Error:Android Dex: [DMD-Android] at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
Error:Android Dex: [DMD-Android] at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
Error:Android Dex: [DMD-Android] at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
Error:Android Dex: [DMD-Android] at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
Error:Android Dex: [DMD-Android] at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
Error:Android Dex: [DMD-Android] at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
Error:Android Dex: [DMD-Android] at com.android.dx.command.dexer.Main.processClass(Main.java:749)
Error:Android Dex: [DMD-Android] ... 20 more
Error:Android Dex: [DMD-Android] 1 error; aborting

1 个答案:

答案 0 :(得分:0)

在Gradle中,请添加:

dexOptions {
    javaMaxHeapSize "4g"
}