2016-03-24 6 views
4

Почему я заменяю JAVA 8 на JAVA 7, ошибка студии Android?Я заменю java 8 на 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: 
............ 

Я думаю, что использовать retroLambda в Android Studio.

Любой, кто сталкивается с подобной проблемой/разрешенным, может дать некоторый указатель для его разрешения.

Я использую Android Studio 2.1 Preview 3 с 2,10

+0

Вы пытались добавить эти две строки в файл build.gradle? –

+0

какие две линии? – allen218

+1

Вы читали журнал ошибок? 'Если вы используете«Java»Gradle плагин в библиотеке подмодуль добавить targetCompatibility =«1,7» sourceCompatibility =«1.7» к build.gradle file.' этого подмодуль в –

ответ

5

класса Если я не получаю неправильно Gradle андроид плагин расширяет «Java» плагин, так что вы можете просто добавить эти две строки в «Android» в блоке your build.gradle:

apply plugin: 'com.android.application' 

android { 

    targetCompatibility = '1.7' 
    sourceCompatibility = '1.7' 

    ... 
} 

Работал нормально для меня.

13

Этот помог мне. В главном файле проекта build.gradle добавьте эти строки кода в раздел allprojects (или добавьте этот раздел, если его там нет).

allprojects { 

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

} 
+1

К сожалению, это не работает = ( – whizzzkey

+0

Это на самом деле –

+0

Если бы эта проблема была модернизирована от Studio 2.1 до 2.2 с не-андроидными Jars, это был ответ. –

Смежные вопросы