gpt4 book ai didi

Android studio 2.3.1 字节码转dex报错

转载 作者:行者123 更新时间:2023-11-29 16:58:22 26 4
gpt4 key购买 nike

我刚刚将此依赖项(编译'com.google.guava:guava:21.0')添加到 gradle 中,当我尝试运行该应用程序时出现以下错误。我尝试清理项目,但没有成功'帮不了我。有人可以帮我解决吗

错误:

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(app):

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'


}

最佳答案

问题出在 Guava/Java 版本上。根据 documentation,Guava 版本 21 及更高版本的要求是 Java 8 .

Android Studio(以及目前的 Android)仍在 JDK 7 上,具有一些 JDK 8 功能。值得庆幸的是,根据this,他们为此提供了 Guava 味。 .

基本上你所要做的就是:

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

希望这对您有所帮助。

关于Android studio 2.3.1 字节码转dex报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43821505/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com