【发布时间】:2019-02-08 20:55:53
【问题描述】:
如果我尝试构建我的应用程序,我会收到此错误:
DuplicateRelativeFileException: 发现多个文件具有独立于操作系统的路径“META-INF/groovy-release-info.properties”
还有这个:
原因:com.android.tools.r8.utils.AbortException:错误:MethodHandle.invoke 和 MethodHandle.invokeExact 仅支持从 Android O (--min-api 26) 开始
我的 build.gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.example.example"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.squareup.okhttp3:okhttp:3.13.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.8.5'
implementation 'com.fasterxml.jackson.core:jackson-core:2.8.5'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.8.5'
implementation 'io.rest-assured:json-path:3.3.0'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'junit:junit:4.12'
testImplementation 'com.squareup.okhttp3:mockwebserver:3.13.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
}
我尝试通过在我的 gradle.build 文件中添加以下代码来解决这个问题:
packagingOptions {
exclude 'META-INF/groovy-release-info.properties'
}
但是我会得到这个错误:
com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\[myUserNamePlaceholder]\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy\2.4.15\74b7e0b99526c569e3a59cb84dbcc6204d601ee6\groovy-2.4.15.jar
请你帮帮我。我已经尝试解决这个问题好几个小时了。我感谢任何对我有很大帮助的答案。
【问题讨论】:
标签: java android android-studio exception