gpt4 book ai didi

安卓工作室 : Dex cannot parse version 52 byte code

转载 作者:行者123 更新时间:2023-11-29 02:40:46 25 4
gpt4 key购买 nike

每当我尝试编译时,我都会收到以下错误-

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.

我的build.gradle文件如下-

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.sbcappium"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
apply plugin: 'android'
targetCompatibility = '1.7'
sourceCompatibility = '1.7'

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'

})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
compile group: 'net.time4j', name: 'time4j-android', version: '3.24-2016i'
testCompile 'junit:junit:4.12'
compile files('libs/cglib-nodep-3.2.4.jar')


compile files('libs/commons-exec-1.3.jar')
compile files('libs/commons-io-2.5.jar')
compile files('libs/commons-lang3-3.5.jar')
compile files('libs/commons-logging-1.2.jar')

compile files('libs/gson-2.8.0.jar')
compile files('libs/guava-21.0.jar')
compile files('libs/hamcrest-core-1.3.jar')


compile files('libs/htmlunit-driver-2.26.jar')

compile files('libs/httpcore-4.4.6.jar')
compile files('libs/httpmime-4.5.3.jar')
compile files('libs/java-client-5.0.0-BETA8.jar')

compile files('libs/jetty-io-9.4.1.v20170120.jar')
compile files('libs/jetty-util-9.4.1.v20170120.jar')
compile files('libs/jna-4.1.0.jar')

compile files('libs/junit-4.12.jar')

compile files('libs/phantomjsdriver-1.4.0.jar')
compile files('libs/sac-1.3.jar')
compile files('libs/selenium-server-standalone-3.4.0.jar')
compile files('libs/serializer-2.7.2.jar')
compile files('libs/websocket-api-9.4.3.v20170317.jar')
compile files('libs/websocket-client-9.4.3.v20170317.jar')
compile files('libs/websocket-common-9.4.3.v20170317.jar')
compile 'com.android.support:support-annotations:25.3.1'}

我已经尝试了以下链接中提供的所有解决方案,但对我来说没有任何效果-

  1. Android: Dex cannot parse version 52 byte code
  2. Andrioid Studio - Error converting bytecode to dex, Cause: Dex cannot parse version 52 byte code

我的 build.gradle 文件有什么问题?请记住,我已根据上述两个链接中提供的解决方案对 gradle 文件进行了所有可能的更改。

最佳答案

请将此代码添加到您的 build.gradle

  compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}

希望你的问题得到解决

关于安卓工作室 : Dex cannot parse version 52 byte code,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44337006/

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