无法在Android Studio中生成签名的apk,收到错误

时间:2016-05-16 07:05:40

标签: java android android-studio build.gradle android-proguard

我在android studio中生成一个已签名的apk但我收到了以下错误:

  

错误:任务执行失败':msapp_V_520:transformClassesWithJarMergingForRelease'。   com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android / support / annotation / ColorRes.class

这是我的 build.gradle

public static Visual GetChildrenByType(Visual visualElement, Type typeElement, string nameElement)
{
   if (visualElement == null) return null;
   if (visualElement.GetType() == typeElement)
     {
        FrameworkElement fe = visualElement as FrameworkElement;
        if (fe != null)
        {
          if (fe.Name == nameElement)
          {
             return fe;
          }
        }
     }
     Visual foundElement = null;
     if (visualElement is FrameworkElement)
        (visualElement as FrameworkElement).ApplyTemplate();
     for (int i = 0; i < VisualTreeHelper.GetChildrenCount(visualElement); i++)
     {
        Visual visual = VisualTreeHelper.GetChild(visualElement, i) as Visual;
        foundElement = GetChildrenByType(visual, typeElement, nameElement);
        if (foundElement != null)
           break;
     }
     return foundElement;
    }

1 个答案:

答案 0 :(得分:0)

在添加support-v4 dependeicy。

时排除facebook模块
compile (project(':facebook')) {
    exclude module: 'support-v4'
}