Recently really busy, accidentally blog and a desolate two months.
From today onwards, we decided to return to CSDN, to record and share.
First from a recently tortured and tormented problem.
Because the V4 package was upgraded. Have always reported this problem:
com.android.dex.DexExceptionMultiple dex files define Landroid/support/annotation/AnimRes;
Clean it every time, and then compile the talent. The process of light wasted 4/5 minutes. This problem arises because the latest V4 package (compile ' com.android.support:support-v4:22.2.1 ') already includes the Annotation.jar package, but this package is also included in the other jar packages. Not the same time including v4/v7 caused, so a bunch of people say in the V7 bag for example the following settings:
compile (‘com.android.support:appcompat-v7:22.2.1‘){ group"com.android.support""support-v4" }
That is, set V7 package does not include V4, this set up is useless.
Just make sure that the local version number of V4 and V7 is the same.
The correct solutions are as follows:
1, find the other dependencies of the project. Must be in one of the jar bags in libs. Hide the Annotation.jar bag, delete it is OK. This is the most Orthodox solution.
2. Downgrade the V4 package. Because the v4 of the high version number includes Annotation.jar, it is possible to force the setting in the outermost build.grable:
{ repositories { jcenter() } configurations.{ resolutionStrategy.force ‘com.android.support:support-annotations:22.1.0‘ }}
3, in the need to V4 bag exclude drop annotation bag. Note that compile will have to add a parenthesis:
compile (‘com.android.support:support-v4:22.2.1‘){ module: ‘support-annotations‘ }
The disadvantage is that every place to use the V4 package is set.
4. Add a sentence in the Dexoptions setting in the application Build.gradle: Predexlibraries = False is OK:
PS: The above four methods are able to solve this problem, recommend Orthodox Method 1 and Lazy Method 4.
Android studio:multiple dex Files define Landroid/support/annotation/animres