Resolves an issue in which Android studio loads third-party jar packages that occur with package reload:

Source: Internet
Author: User
Tags maven central

When adding a third-party jar package through the MAVEN Central Library, there was a problem of repeatedly loading the jar package, and the workaround was simply to get rid of the one that didn't allow it to load.

First, the error

Error:execution failed for task ': App:dexdebug ' .> com.android.ide.common.internal.LoggedErrorException:Failed to Run Command:f:\zsl\sdk\build-tools\21.1.2\dx.bat--dex--output F:\zsl\Android\pro\RecipesDaquan\app\build\ Intermediates\dex\debug--input-list=f:\zsl\android\pro\recipesdaquan\app\build\intermediates\tmp\dex\debug\ Inputlist.txterror code:2output:unexpected top-level exception:com.android.dex.dexexception:<strong> < Span style= "color: #3333ff;" >multiple dex files define Landroid/</span><span style= "color: #ff0000;" >support/v4</span><span style= "color: #3333ff;" >/accessibilityservice/accessibilityserviceinfocompatics;</span></strong>at Com.android.dx.merge.DexMerger.readSortableTypes (dexmerger.java:596) at Com.android.dx.merge.DexMerger.getSortedTypes (dexmerger.java:554) at Com.android.dx.merge.DexMerger.mergeClassDefs (dexmerger.java:535) at Com.android.dx.merge.DexMerger.mergeDexes ( dexmerger.java:171) at Com.android.dx.merge.DexMerGer.merge (dexmerger.java:189) at Com.android.dx.command.dexer.Main.mergeLibraryDexBuffers (main.java:454) at Com.android.dx.command.dexer.Main.runMonoDex (main.java:303) at Com.android.dx.command.dexer.Main.run (Main.java : 246) at Com.android.dx.command.dexer.Main.main (main.java:215) at Com.android.dx.command.Main.main (main.java:106)

We can see from the above error that SUPPORT_V4 's package is repeatedly loaded and compiled, so let's take a look at the Gradle-app file


dependencies {    Compile filetree (dir: ' Libs ', include: [' *.jar '])    compile ' com.android.support:appcompat-v7 : 21.0.0 '    <span style= "color: #ff0000;" >compile ' in.srain.cube:cube-sdk:1.0.42.1 ' </span>    compile files (' Libs/android-async-http-1.4.6.jar ' )}
The introduction of the V7 package will automatically be loaded to compile a v4:21.0.0 package, and in the in.srain.cube:cube-sdk:1.0.42.1 library there is a V4 package, so we need to remove a


To see if libraries is what we're talking about, load the V4 package repeatedly


Ii. Solutions

dependencies {    Compile filetree (dir: ' Libs ', include: [' *.jar '])    compile ' com.android.support:appcompat-v7 : 21.0.0 '    <span style= "color: #ff0000;" >compile (' in.srain.cube:cube-sdk:1.0.42.1 ') {        exclude module: ' Support-v4 '    }</span>    compile Files (' Libs/android-async-http-1.4.6.jar ')}
Remove the package from the in.srain.cube:cube-sdk:1.0.42.1 without loading.



Resolves an issue in which Android studio loads third-party jar packages that occur with package reload:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.