This is caused by library dependencies that have been compiled using Java 8 or above.

忘是亡心i 2023-10-17 08:28 226阅读 0赞

This is caused by library dependencies that have been compiled using Java 8 or above.

发布Java Library 开源库后,在项目中使用,出现以下错误

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

需在Java Library 中的 build.gradle 添加

  1. apply plugin: 'java'
  2. //添加开始
  3. sourceCompatibility = 1.7
  4. targetCompatibility = 1.7
  5. //添加结束
  6. dependencies {
  7. compile fileTree(dir: 'libs', include: ['*.jar'])
  8. }

然后重新发布后,即可

发表评论

表情:
评论列表 (有 0 条评论,226人围观)

还没有评论,来说两句吧...

相关阅读