我正在开发一款使用谷歌应用引擎的应用。 建筑很好但是当我试图运行时, 我收到这个错误:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/appengine/repackaged/com/google/api/client/http/AbstractHttpContent.class
尝试在android studio中运行应用程序时。
这是我的傻瓜:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "bgu.wingmanapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
// testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile project(path: ':backend', configuration: 'android-endpoints')
compile ('com.google.appengine:appengine-api-1.0-sdk:1.9.18')
compile ('com.google.appengine:appengine-endpoints:1.9.18')
}
和后端gradle:
// If you would like more information on the gradle-appengine-plugin please refer to the github page
// https://github.com/GoogleCloudPlatform/gradle-appengine-plugin
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.18'
}
}
repositories {
jcenter();
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.18'
compile 'com.google.appengine:appengine-endpoints:1.9.18'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.18'
compile 'javax.servlet:servlet-api:2.5'
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
endpoints {
getClientLibsOnBuild = true
getDiscoveryDocsOnBuild = true
}
}
我知道我有一个ducplicate依赖,但我无法解决它。谢谢!
答案 0 :(得分:1)
如果你编译这个项目:
compile project(path: ':backend', configuration: 'android-endpoints')
如果您运行以下两个符合,那么您将拥有上面编译的项目的副本。你应该删除它们:
compile ('com.google.appengine:appengine-api-1.0-sdk:1.9.18')
compile ('com.google.appengine:appengine-endpoints:1.9.18')
如果您使用的是:
compile fileTree(dir: 'libs', include: ['*.jar'])......(I am aware you have commented it out)
您也可能拥有与“app”或“backend”模块中相同的外部库文件,这些模块由于编译整个文件树而被调用两次。