gpt4 book ai didi

android - 错误 :Execution failed for task ':app:transformResourcesWithMergeJavaResForRelease'

转载 作者:行者123 更新时间:2023-11-30 01:39:45 27 4
gpt4 key购买 nike

build.gradle:

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "com.classic"
minSdkVersion 15
targetSdkVersion 23
versionCode 5
versionName "1.5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

useLibrary 'org.apache.http.legacy'
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'joda-time:joda-time:2.8.2'
compile "org.apache.httpcomponents:httpcore:4.2.4"
compile "org.apache.httpcomponents:httpmime:4.3"
}

生成 APK 时:

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForRelease'.

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/DEPENDENCIES File1: /home/sun/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.3/11393498b38e9695d0850cac26fde5613ae268b9/httpcore-4.3.jar File2: /home/sun/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpmime/4.3/5b0002c5fb66867ca919be0fbd86de1cfaf76da7/httpmime-4.3.jar

更新 #2

我已将 jars 复制到 libs 文件夹中并获取

错误:任务 ':app:transformResourcesWithMergeJavaResForRelease' 执行失败。

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/DEPENDENCIES File1: /home/sun/AndroidStudioProjects/Classic/app/libs/httpclient-4.3.6.jar File2: /home/sun/AndroidStudioProjects/Classic/app/libs/httpcore-4.3.3.jar File3: /home/sun/AndroidStudioProjects/Classic/app/libs/httpmime-4.3.6.jar

这里更新了build.gradle

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "com.classic"
minSdkVersion 15
targetSdkVersion 23
versionCode 5
versionName "1.5"

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

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile files('libs/pgsdk.jar')
compile 'joda-time:joda-time:2.8.2'
compile files('libs/httpclient-4.3.6.jar')
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.3.6.jar')
}

最佳答案

尝试在打包中排除该文件:

android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
(...)
}
}

关于android - 错误 :Execution failed for task ':app:transformResourcesWithMergeJavaResForRelease' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34648807/

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