Error in android studio java

2019-09-29 04:27发布

问题:

please help us.. we cant find whats wrong..

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

回答1:

You're compiling some code which uses the invokedynamic instruction, which is not supported on Android. One possible reason is that you've used the Java 8 compiler and used lambdas in your code. Another possibility is that you're trying to use a class which wasn't written in Java, but in some other language such as Groovy.