Dex:将字节码转换为dex时出错:原因:Dex无法以统一的andorid构建方式解析版本52字节的代码

时间:2018-08-09 10:18:17

标签: android unity3d tensorflow

我已经将Tensorflow Android实现为一个统一插件。构建aar并集成到Unity项目后,出现错误:

CommandInvokationFailure: Gradle build failed. 
/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/bin/java -classpath "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"

stderr[
Dex: Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add 
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle

我在以下位置有一个tensorflow文件:https://jcenter.bintray.com/org/tensorflow/tensorflow-android/1.8.0/ 并复制到Assets / Plugin,但仍然出现此错误。 我被困在一天中,无法解决问题。

1 个答案:

答案 0 :(得分:0)

将tensorflow降级到1.4对我有用。另一个解决方案是使用Tensorflow锋利的统一性