我将Java 8替换为Java 7 android studio错误? [英] I replace java 8 with java 7 android studio error?

查看:102
本文介绍了我将Java 8替换为Java 7 android studio错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我用JAVA 7替换JAVA 8,Android Studio错误?

why I replace JAVA 8 with JAVA 7,Android studio error?

> Error: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 file.
Error:...while parsing android/support/v7/recyclerview/R$attr.class
Error: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 file.
Error:...while parsing android/support/v7/recyclerview/R$dimen.class
Error: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 file.
Error:...while parsing android/support/v7/recyclerview/R$id.class
Error: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 file.
Error:...while parsing android/support/v7/recyclerview/R$styleable.class 
Error: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 file.
Error:...while parsing android/support/v7/recyclerview/R.class
Error: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 file.
Error:...while parsing com/example/administrator/comjarlib/R$anim.class
Error:Error converting bytecode to dex:
............

我想在Android Studio中使用retroLambda.

I think to use retroLambda in Android Studio.

面临类似问题/已解决的任何人都可以提供一些解决此问题的指针.

Anyone facing similar issue / resolved can give some pointer to resolve it.

我正在使用2.10级的Android Studio 2.1 Preview 3

I am using Android Studio 2.1 Preview 3 with grade 2.10

推荐答案

这个帮助了我.在您项目的主build.gradle文件中,将以下几行代码添加到allprojects部分中(如果没有,请添加此部分).

This one helped me. In your project's main build.gradle file add these lines of code into allprojects section (or add this section if it isn't there).

allprojects {

    tasks.withType(JavaCompile) {
        sourceCompatibility = 1.7
        targetCompatibility = 1.7
    }

}

这篇关于我将Java 8替换为Java 7 android studio错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆