android - Multiple dex files define: when I am adding admob. this is due to ActionbarSherlock Lib -
when adding admob gradle file,i getting "com.android.dex.dexexception: multiple dex files define landroid/support/annotation/animres;". happening because of actionbarsherlock lib. after searching on google, people suggested remove support v4 jar file.but solution not working. please me out solution.
edit
my gradle file:
buildscript { repositories { mavencentral() // or jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.1.3' } } apply plugin: 'com.android.application' dependencies { compile files('libs/bolts-android-1.1.4.jar') compile files('libs/bolts-android-1.1.4-javadoc.jar') compile files('libs/picasso-2.3.4.jar') compile files('libs/parse-1.8.3.jar') compile project(':customtablib') compile project(':simple-crop-image-lib') compile project(':slidedatetimepicker') compile files('libs/gcm.jar') // compile files('libs/google-play-services.jar') // compile 'com.google.android.gms:play-services:7.5.0' compile 'com.google.android.gms:play-services-ads:7.5.0' compile files('libs/libphonenumber-7.0.7.jar') compile project(':actionbarsherlocklibrary') } android { compilesdkversion 21 buildtoolsversion "22.0.0" compileoptions { sourcecompatibility javaversion.version_1_7 targetcompatibility javaversion.version_1_7 } sourcesets { main { manifest.srcfile 'androidmanifest.xml' java.srcdirs = ['src'] resources.srcdirs = ['src'] aidl.srcdirs = ['src'] renderscript.srcdirs = ['src'] res.srcdirs = ['res'] assets.srcdirs = ['assets'] } // move tests tests/java, tests/res, etc... instrumenttest.setroot('tests') // move build types build-types/<type> // instance, build-types/debug/java, build-types/debug/androidmanifest.xml, ... // moves them out of them default location under src/<type>/... // conflict src/ being used main source set. // adding new build types or product flavors should accompanied // similar customization. debug.setroot('build-types/debug') release.setroot('build-types/release') } // dexoptions { // predexlibraries = false // } }
i have edited question @destro.
try if you're having dependency conflict v4 support library, can exclude 1 of libraries via gradle script:
e.g
compile ('com.android.support:recyclerview-v7:+') { exclude module: 'support-v4' }
Comments
Post a Comment