遇到Error:Execution failed for task ':app:transformClassesWithDexForDebug'的解决方案

  • 原因:项目中包含了所有的google play service
  • 解决:只需要使用必要的服务即可
    • 将compile 'com.google.android.gms:play-services:8.1.0'改为
    • compile 'com.google.android.gms:play-services-maps:8.1.0'
    • compile 'com.google.android.gms:play-services-plus:8.1.0'
In versions of Google Play services prior to 6.5, you had to compile the entire package of APIs into your app. In some cases, doing so made it more difficult to keep the number of methods in your app (including framework APIs, library methods, and your own code) under the 65,536 limit.

From version 6.5, you can instead selectively compile Google Play service APIs into your app. For example, to include only the Google Fit and Android Wear APIs, replace the following line in your build.gradle file: 
compile 'com.google.android.gms:play-services:8.3.0' 
with these lines:

compile 'com.google.android.gms:play-services-fitness:8.3.0' 
compile 'com.google.android.gms:play-services-wearable:8.3.0'
原文地址:https://www.cnblogs.com/coderwjq/p/6857263.html