Monday, August 1, 2016

Resolving for task transformClassesWithDexForDebug

I encountered an Android Studio build exception while compiling an Android application to run on a device. The error message is shown in the screen shot below:

The message about classes and Dex gave a huge clue about the cause of the exception; I came across somewhere that there is a limit to the number of classes in a Dex file and Google Play Services use a lot of classes. My app's build.gradle has the dependency to the full file, as shown below.

So one method to reduce the number of classes is to use subsets of the Google Play Services library. Instead of the full dependency, my build.gradle file now has the following dependency line:
compile ''

Following this change, the application builds successfully, as shown in the console screen shot below.

No comments:

Related Posts with Thumbnails