2017-05-06 4 views
1

방금이 종속성을 추가했는데 (응용 프로그램을 실행할 때 com.google.guava : guava : 21.0 '을 컴파일하면 오류가 발생합니다) 나는 프로젝트를 청소했지만, 그것은 누군가가 솔루션을Android studio 2.3.1 바이트 코드를 dex로 변환하는 중 오류가 발생했습니다.

오류 좀 도와주세요 실례합니다 도움이되지 않았다 :

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:1 error; aborting 
Error:Execution failed for task ':app:transformClassesWithDexForDebug'. 
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex 'C:\Users\Zabit\.gradle\caches\modules-2\files-2.1\com.google.guava\guava\21.0\3a3d111be1be1b745edfa7d91678a12d7ed38709\guava-21.0.jar' to 'E:\Ohxee\app\build\intermediates\transforms\dex\debug\folders\1000\10\guava-21.0_c8c319a8080e46e7bfc8243fe4c3e3b2a6150f16' 

build.gradle (응용 프로그램) :

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.0" 
    defaultConfig { 
     applicationId "com.example.xxxx.xxx" 
     minSdkVersion 16 
     targetSdkVersion 25 
     multiDexEnabled true 

     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    }} 


dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.borax12.materialdaterangepicker:library:1.9' 
    compile 'com.iceteck.silicompressorr:silicompressor:1.1.0' 
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' 
    compile 'com.squareup.picasso:picasso:2.5.2' 
    compile 'com.github.bumptech.glide:glide:3.7.0' 
    compile 'com.android.support:appcompat-v7:25.3.1' 
    compile 'com.patrickpissurno:ripple-effect:1.3.1' 
    compile 'com.android.support:design:25.3.1' 
    compile 'com.android.support:cardview-v7:25.3.1' 
    compile 'com.android.volley:volley:1.0.0' 
    compile 'com.google.android.gms:play-services-maps:10.2.4' 
    testCompile 'junit:junit:4.12' 
    compile 'com.roughike:bottom-bar:1.4.0.1' 
    compile 'com.github.darsh2:MultipleImageSelect:3474549' 
    compile 'com.google.guava:guava:21.0' 
    compile 'com.android.support:multidex:1.0.1' 


} 

답변

1

먼저 깨끗한 프로젝트

프로젝트를 확인하려고보다

이제 실행 문제는 구아바/자바 버전 인 프로젝트 모듈

+0

여전히 같은 오류 – jobin

+0

, 당신이 compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } 을 추가하고 build.gradle 내에서 사용해 볼 수 (프로젝트/모듈) –

+0

이제이 erorr 오류가 발생했습니다 : (23, 0) org.gradle.api.Project 유형의 'app :'프로젝트에서 [build_58jzqqrivbdfgfchs104vwi47 $ _run_closure2 @ 3c095506] 인수에 대한 메소드 compileOptions()를 찾을 수 없습니다. Open File jobin

2

. Guava 버전 21 이상에서는 documentation에 따라 Java 8이 필요합니다.

Android Studio (및이 시점에서 Android)는 JDK 7의 일부 기능과 함께 JDK 7에 있습니다. 고맙게도 그들은 this에 따른 구아바 향을 제공합니다.

은 기본적으로 당신이 할 일은 다음과 같습니다

compile 'com.google.guava:guava:22.0-android' 

희망이 도움이됩니다. 당신이 서브 모듈 프로젝트가있는 경우

관련 문제