2016-03-24 3 views
4

私はなぜJAVA 8をJAVA 7に置き換えますか、Androidスタジオのエラーですか?私はJava 7のアンドロイドスタジオエラーでJava 8を置き換えますか?

> 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スタジオでretroLambdaを使用すると思います。

同様の問題に直面しているか解決済みの人は、それを解決するためのポインタを与えることができます。

私が間違っているのGradleアンドロイドプラグインを取得しない場合、私はグレード2.10

+0

build.gradleファイルに2行追加してみましたか? –

+0

2行? – allen218

+1

エラーログを読みましたか?あなたは、ライブラリのサブモジュールでのJava "のGradleプラグインを使用している場合は' –

答えて

5

とAndroidのメーカー2.1プレビュー3を使用していますが「Javaのプラグインを拡張するので、あなただけで、あなたの「アンドロイド」ブロックに次の2行を追加することができますあなたの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

file.'そのサブモジュールのbuild.gradleに targetCompatibility =「1.7」 sourceCompatibility =「1.7」 を追加残念ながら、これは=( – whizzzkey

+0

実際にこれを動作しません。 –

+0

この問題は、Studio 2.1から2.2にアップグレードされていて、アンドロイド以外のJarを使用していた場合は、これが答えです –

関連する問題