添加Play Services GCM依赖关系gradle之后,它将不再构建。我在构建期间遇到此错误
- 同步:确定
- 制作项目:好的
- 清洁:好的
- 运行:错误
应用程序:transformClassesWithJarMergingForDebug”:com.android.build.transform.api.TransformException: java.util.zip.ZipException:重复条目: 机器人/支撑/注解/ AnimatorRes.class
这个问题可能是图书馆之间的冲突。所以我尝试从新添加的渐变中排除支持-V4冲突。仍然存在问题。
这个问题很可能是因为超过了Android强加的65K方法dex限制。所以我尝试清理项目,并从构建中的依赖项中删除一些未使用的库和方法。 Gradle,OR通过添加multidex支持
Gradle文件:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.widevision.dressnroom"
minSdkVersion 16
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
preDexLibraries = false
incremental true
javaMaxHeapSize "4g"
}
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = ['--multi-dex']
} else {
dx.additionalParameters += '--multi-dex'
}
}
}
}
dependencies {
compile files('libs/activeandroid-3.0.jar')
compile files('libs/android-query-full.0.25.10.jar')
compile files('libs/gson-2.2.4.jar')
compile files('libs/okhttp-2.0.0.jar')
compile files('libs/okio-1.0.0.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/joda-time-2.0.jar')
compile files('libs/commons-lang3-3.4.jar')
compile 'com.balysv:material-ripple:1.0.2'
compile files('libs/anjlab-iabv3-current.jar')
compile ('com.google.android.gms:play-services:8.1.0')
{
exclude group: 'com.android.support', module: 'support-v4'
}
compile ('com.android.support:multidex:1.0.1')
{
exclude group: 'com.android.support', module: 'support-v4'
}
}