This blog, just the development of their own often encountered in the packaging and compilation problems and solutions to share a little bit, do not seek attention, but to be useful.
1, we all know that we often encounter the problem of Dex beyond the number of methods, So many people will use Android.support-multidex to solve, but you may encounter the following such a mistake, can not help but let you think, this error is generally introduced a number of the same package, but you open, libs under clearly only a bag ah, let a person headache.
Error:execution failed for task ': App:packagealldebugclassesformultidex '.
> Java.util.zip.ZipException:duplicate Entry:android/support/multidex/multidex.class
The solution is as follows: first delete the jar package below Libs and release the dependency, and then in the Gradle script, add compile ' com.android.support:multidex:1.0.1 '
(Currently the latest version is 1.0.1), successfully resolved.
2, believe that the following problem is also more common, at least the landlord encountered many times, the front did not make notes, engage in every time to understand, so this problem must be summed up, miscellaneous a look is V4 package repeated.
* What went wrong:
Execution failed for task ': App:transformclasseswithjarmergingfordebug '.
> Com.android.build.api.transform.TransformException:java.util.zip.ZipException:duplicate Entry:android/ Support/annotation/colorres.class
The specific solution is: as many third-party packages will use the V4 support package, so when you import multiple support, it is inevitable that this error, just add in Build.gradle
Configurations {
All*.exclude group: ' Com.android.support ', module: ' Support-v4 '
}
Then clean the project and build it. Remember that you must clean, or you will not be able to solve!!
"Continuous Update" Android Studio compiles a variety of incurable diseases, always have you want to ~