Gradle Build Error : Duplicate Entry
My gradle file is apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion '24.0.0 rc2' defaultConfig { applicationId 'com.test.test' min
Solution 1:
Take care if you have other subproject included. You can probably fix it by adding in your "proguard-rules.pro" the following exception :
-dontwarn org.apache.**
Solution 2:
Modify your gradle like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0 rc2"
defaultConfig {
applicationId "com.test.test"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
repositories {
mavenCentral()
jcenter()
flatDir {
dirs '../libs'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile'com.android.support:appcompat-v7:23.3.0'compile('com.google.android.gms:play-services:8.4.0') {
exclude group: 'com.google.guava'
}
compile ('org.apache.httpcomponents:httpcore:4.4.4')
{
exclude group: 'org.apache.http.annotation.NotThreadSafe'
}
compile'commons-io:commons-io:2.4'compile'com.android.support:support-annotations:23.0.0'compile'com.android.support:recyclerview-v7:23.0.0'compile'com.google.android.exoplayer:exoplayer:r1.4.2'compile'com.mopub.volley:mopub-volley:1.1.0'compile'com.android.support:multidex:1.0.0'
}
the packagingOptions
will let you use duplicate classes. That means if two libraries having same class names then compiler will ignore that.
Solution 3:
Clean project and then build again .duplicate entry error will resolve.
Post a Comment for "Gradle Build Error : Duplicate Entry"