在 Android Studio 中包含 Java 模块作为依赖项时出现的 Java 编译器错误
2022-09-04 06:54:25
我在Android Studio项目中有一个Java模块,它是Android模块的依赖项。我在构建时遇到问题,出现以下异常。
Error:Execution failed for task ':myApplication:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Applications/Android Studio.app/sdk/build-tools/android-4.4W/dx --dex --output ~/myapplication-app-android/dev/biketracks-app-android/bikeTracks/build/intermediates/pre-dexed/debug/coreUtilities-6ee7e0aafa5a6db72b2acb078f065e51c43124c2.jar ~/myapplication-app-android/dev/myapplication-app-android/libs/coreUtilities/build/libs/coreUtilities.jar
Error Code:
1
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:665)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
at com.android.dx.command.dexer.Main.access$600(Main.java:78)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
...while parsing com/corecoders/coreutilities/GPSUtils.class
1 error; aborting
经过一些阅读,我可以看到它与Android Studio正在使用的Java编译器有关。但是,我看不到更改它使用的编译器的方法。
我试图包含在Android模块中的Java模块是我使用Android Studio创建的模块,方法是将File > New Module>Java Module,因此我看不到任何可以做出的不同选项?
任何想法都会很棒。