gpt4 book ai didi

android - 持续性错误 - 任务 ':app:transformClassesWithJarMergingForDebug' 执行失败

转载 作者:行者123 更新时间:2023-11-30 01:23:49 28 4
gpt4 key购买 nike

我正在尝试将 Microsoft Azure 移动服务添加到我现有的 Android 应用程序中。在我的文件夹中添加 .jar 文件后。我收到错误:

Execution failed for task ':app:transformClassesWithJarMergingForDebug.

对于 annotation.classGson$5.class 等各种文件,正如您在错误文件中看到的那样,它显示了 ApiJsonOperationCallback.class .我已经厌倦了很多事情(例如 ./gradlew clean 和 ./gradlew clean assemble),但到处都遇到了死胡同。

这是我的gradle文件

apply plugin: 'com.android.application'
android {compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.jino.navigationplacepicker"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
defaultConfig {
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildscript {
repositories {
jcenter()
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-javadoc.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-sources.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/gson-2.2.2.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/guava-17.0.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3.jar')
}

这是错误信息

:app:compileDebugNdk UP-TO-DATE :app:compileDebugSources :app:transformClassesWithJarMergingForDebug FAILED Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/microsoft/windowsazure/mobileservices/ApiJsonOperationCallback.class :app:compileDebugJavaWithJavac Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Information:BUILD FAILED

请求你对此感到高兴,并以通俗易懂的方式回应,因为我是新手。

最佳答案

这些库在 gradle 文件中被引用了两次,导致它们相互冲突。

不需要以下行。

compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-javadoc.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-sources.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/gson-2.2.2.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/guava-17.0.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3.jar')

以下行将下载并引用 Azure 移动服务所需的二进制文件。

compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'

这是一个正常运行的 Android 应用程序的 gradle 文件的副本。

apply plugin: 'com.android.application'

android {
compileSdkVersion 20
buildToolsVersion "19.1.0"

defaultConfig {
applicationId "com.example.yourapp"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

repositories {
flatDir {
dirs 'aars'
}
}
}

dependencies {
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.guava:guava:18.0'
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
}

关于android - 持续性错误 - 任务 ':app:transformClassesWithJarMergingForDebug' 执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36727515/

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