I have gone through many answers for this question like: Error :: duplicate files during packaging of APK Gradle sync fails after adding Firebase dependency: duplicate files during packaging of APK
But still after adding packagingOptions I am getting duplicate file error.
I am working on library and here is my app build gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.mcxiaoke.volley:library:1.0.14'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile('org.apache.httpcomponents:httpmime:4.3')
}
EDIT
Adding packagingOption to my sample where I am adding my library as dependency solves the problem can anyone let me know why I have to add it to my sample build.gradle? Or is there any way to remove from sample.