How to exclude the support v4 library from the studio?

FAILURE: Build failed with an exception.

    <li>What went wrong: Execution failed for task ':transformClassesWithJarMergingForDebug'.

    com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/content/Loader$OnLoadCompleteListener.class

    </li> </ul>

    Code in build.gradle file

    apply plugin: 'com.android.application' dependencies { compile fileTree(dir: 'libs', include: '*.jar') //compile project(':ActionBarSherlock-4.1.0') compile project(':GooglePlayServicesLibrary') compile files('libs/eventbus-2.4.0.jar') compile (project(':AndroidBetterPickers')){ exclude module: 'support-v4' } compile (project(':ZxingFragmentLib')){ exclude module: 'support-v4' } compile (project(':RobotoTextView')){ exclude module: 'support-v4' } compile (project(':PanesLibrary')){ exclude module: 'support-v4' } compile (project(':ShowCaseViewLibrary')){ exclude module: 'support-v4' } compile (project(':ActionBarSherlock-4.1.0')){ exclude module: 'support-v4' } } buildscript { repositories { jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.1.3' } } allprojects { repositories { jcenter() mavenCentral() } } android { packagingOptions { exclude 'META-INF/maven/com.nineoldandroids/library/pom.xml' exclude 'META-INF/maven/com.nineoldandroids/library/pom.properties' exclude 'META-INF/services/javax.annotation.processing.Processor' } dexOptions { javaMaxHeapSize "4g" } compileSdkVersion 19 buildToolsVersion '22.0.1' defaultConfig { minSdkVersion 15 targetSdkVersion 15 multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['.apt_generated','res','src'] resources.srcDirs = ['.apt_generated','res','src'] aidl.srcDirs = ['.apt_generated','res','src'] renderscript.srcDirs = ['.apt_generated','res','src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/<type> // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } }


    I've done it like this

    dependencies { api('com.android.support:recyclerview-v7:22.2.0') { exclude module: 'support-v4' } }


    I got the same problem, after reset implementation to compile, it works fine, but I don't know why..... maybe it's a bug of 'implementation'


    dependencies { compile fileTree(dir: 'libs', include: '*.jar') // compile project(':ActionBarSherlock-4.1.0') compile project(':GooglePlayServicesLibrary') compile files('libs/eventbus-2.4.0.jar') compile (project(':AndroidBetterPickers')) compile (project(':ZxingFragmentLib')) compile (project(':RobotoTextView')) compile (project(':PanesLibrary')) compile (project(':ShowCaseViewLibrary')) compile (project(':ActionBarSherlock-4.1.0')) compile files('libs/support-v4-19.0.1.jar')


  • copying rows with checked checkboxes
  • FirebaseCrash: Failed to initialize crash reporting
  • Parallel proccessing in R doParallel foreach save data
  • createFileAtPath & OCUnit & errno blues
  • AngularJS is breaking the routing url
  • How to copy pandas DataFrame values down to fill 0's?
  • How does a GPU group threads into warps/wavefronts?
  • Get list with condition on sub list
  • Can't access my folder because of WordPress [closed]
  • python - Fill in missing dates with respect to a specific attribute in pandas
  • ASP.NET MVC C#: Object reference errors when going to view record details
  • After switching from Spring Boot 1.2.8 to 1.3.2 application magically stops working
  • Directory structure and labeling in Caffe
  • How to get database credentials into a c# application without committing it to source code?
  • Installing PySide - OSX
  • Router.create in react-router v1.0.0
  • C++, user input check for '\\0' stops at spaces?
  • Loading a Type Library via PowerShell and scripting Windows Live Writer
  • Net-ssh session timeout
  • How to startActivity for Result from Activity under Group Activity Under Tabs?
  • Is it possible to make imports depend on the location of my Lua script instead of the current direct
  • How can I include the Ivy dependency and none of its dependencies?
  • C++ - Is destructor called when a vector holds objects?
  • Installing samr in in R 3.4
  • scrollOverflow not working in fullPage.js
  • how to check the textarea content is blank using javascript?
  • HighCharts - Show tooltip on column where value is 0 or null
  • Find 5 consecutive numbers in numpy array by row, ignore duplicates
  • In C what exactly happens if i use () to initialize a double dimension array instead of the {}?
  • Is it possible to define rest argument in OCaml?
  • msbuild create itemgroup from property group
  • Authentication in Play! and RestEasy
  • Django simple Captcha “No module named fields” error
  • How do I exclude a dependency in provided scope when running in Maven test scope?
  • Is there a perl module to validate passwords stored in “{crypt}hashedpassword” “{ssha}hashedpassword
  • java inputstream
  • Meteor helpers not available in Angular template
  • Numpy divide by zero. Why?
  • using HTMLImports.whenReady not working in chrome
  • Converting MP3 duration time