2017-01-15 13 views
2

インターネットは[source &ターゲット]の互換性フィールドが問題ではないと思われるようですが、私が何をしてもエラーを揺さぶる。Android Studio 2.2.3の「サポートされていないクラスファイルのバージョン52.0」エラーを解決するには

インポートされたEclipseプロジェクトからWindows 10でAndroid Studio 2.2.3を実行しています。私の構成は次のとおりです。

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion '25.0.2' 

    defaultConfig { 
     applicationId "com.stuff.MyApp" 
     minSdkVersion 23 
     targetSdkVersion 25 
    } 

    buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt', 'proguard-google-api-client.txt' 
     } 
    } 

    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_7 
     targetCompatibility JavaVersion.VERSION_1_7 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile 'com.android.support:support-v13:25.1.0' 
    compile 'com.google.http-client:google-http-client-gson:1.22.0' 
    compile 'com.google.code.gson:gson:2.8.0' 
    compile 'com.google.guava:guava:21.0' 
    compile 'com.google.android.gms:play-services:10.0.1' 
    compile 'com.google.apis:google-api-services-drive:v2-rev249-1.22.0' 
    compile 'org.jsoup:jsoup:1.10.2' 
    compile 'org.apache.commons:commons-lang3:3.5' 
    compile 'org.apache.commons:commons-collections4:4.1' 
    compile 'com.google.api-client:google-api-client-jackson2:1.22.0' 
    compile 'com.google.http-client:google-http-client:1.22.0' 
    compile('com.google.api-client:google-api-client-android:1.22.0') { 
     exclude group: 'org.apache.httpcomponents' 
    } 
    compile('com.google.apis:google-api-services-sheets:v4-rev40-1.22.0') { 
     exclude group: 'org.apache.httpcomponents' 
    } 
} 

ビルド・メイクのプロジェクトやbuild.gradle同期から正常に罰金構築するようだが、私は実行またはデバッグするとき、私は最終的には次のエラーを取得:でも

To run dex in process, the Gradle daemon needs a larger heap. 
It currently has 1024 MB. 
For faster builds, increase the maximum heap size for the Gradle daemon to at least 1536 MB. 
To do this set org.gradle.jvmargs=-Xmx1536M in the project gradle.properties. 
For more information see https://docs.gradle.org/current/userguide/build_environment.html 


AGPBI: {"kind":"error","text":"PARSE ERROR:","sources":[{}]} 
AGPBI: {"kind":"error","text":"unsupported class file version 52.0","sources":[{}]} 
AGPBI: {"kind":"error","text":"...while parsing com/google/common/annotations/Beta.class","sources":[{}]} 
AGPBI: {"kind":"error","text":"1 error; aborting","sources":[{}]} 

:app:transformClassesWithDexForDebug FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':app:transformClassesWithDexForDebug'. 
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

Iをgradle JVMのRAMをアップしようとしましたが、私のEclipseプロジェクトはgradle.window.propertiesとlocal.properatiesというgradle.propertiesファイルを持っていないようです。 Android StudioとGradleの新機能です

プロジェクトのbuild.gradleはそれで次があります。少しもこれで台無し

dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.3' 
} 

が、これは2.14.1であるAndroidのメーカーが使用するバージョン対バージョンのプラグインを右のようです。これらの違いについて少し混乱しますが、その有用な情報を示します。

アイデア?

答えて

0

これは、IDEプロジェクトで設定されたjava SDKのバージョンが、クラスパス上のライブラリの一部をコンパイルするために使用されるSDKの背後にあることを意味します。ちょうど適切なものを設定してください(私は1.8に行くでしょう)

+0

互換性を1.8に変更してJakeのサポートを追加しようとしましたが、LambdaのJavaコードにエラーが発生します – Jaime

+0

lambdaがサポートされていない場合、JDKは1.8ではありません。JDKバージョンとしても調整する必要がありますソースレベルとして。 –

+0

Android Studioで1.8をターゲットにするために必要なJakeの使用と関係しています。間違った文を作るのではなく、試してみてください。また、https://code.google.com/p/android/issues/detail?id=211386をご覧になり、なぜ1.7を守るべきかを確認してください。 – Jaime

0

私は同様の問題があります。しかし、私のcompileOptionsは

compileOptions { 
    sourceCompatibility JavaVersion.VERSION_1_8 
    targetCompatibility JavaVersion.VERSION_1_8 
} 

エラーメッセージがあなた

AGPBI: {"kind":"error","text":"PARSE ERROR:","sources":[{}]} 
AGPBI: {"kind":"error","text":"unsupported class file version  52.0","sources":[{}]} 
AGPBI: {"kind":"error","text":"...while parsing  com/google/common/annotations/Beta.class","sources":[{}]} 
AGPBI: {"kind":"error","text":"1 error; aborting","sources":[{}]} 

のようなもので、エラーがcom/google/common/annotations/Beta.class

をペアリングに起こった私はcompile 'com.google.guava:guava:21.0'

に属するBeta.classは、だから私は削除したことが分かったと述べていますグアバの使用とそのエラーはなくなりました。 これがあなたを助けてくれることを願っています。

関連する問題