title: Exclude class from cross-project dependency via Gradle
body: <p>I've recently upgraded to Unity 5.6 in hopes of utilizing the Gradle build pipeline (to workaround the nasty dex limit).</p>
  
  <p>After some days of configuring it, I ran into this head-cracking issue. Here is the error as displayed in the Unity Editor console:</p>
  
  <pre><code>Execution failed for task ':transformClassesWithJarMergingForRelease'.
  &gt; com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: my/unity/game/BuildConfig.class
  </code></pre>
  
  <p>So it seems that some plugin/external project is including a BuildConfig class file with the exact same package name (as depicted by the file structure, and also why I had to set enforceUniquePackageName to false in the main project gradle).</p>
  
  <p>In Android Studio, when looking for the BuildConfig file, I noticed two different projects that had the same package name. One of the projects was definitely for the main Unity project, while the other was for an automatically included project: unity-android-resources.</p>
  
  <p>Is there a way I could somehow either:</p>
  
  <ul>
  <li>Exclude the BuildConfig.java from the automatically generated
  unity-android-resources project via the main gradle file? or, </li>
  <li>Is there someway I could alter the package name for the automatically
  generated BuildConfig.java file for unity-android-resources?</li>
  </ul>
  
  <p>If it helps, here are the dependencies (and no, doesn't seem like I can just remove unity-android-resources dependency, as the build fails due to some missing icon resources):</p>
  
  <pre><code>dependencies {
       compile fileTree(dir: 'libs', include: ['*.jar'])
       compile(name: 'GoogleAIDL', ext:'aar')
       compile(name: 'GooglePlay', ext:'aar')
       compile(name: 'appcompat-v7-23.4.0', ext:'aar')
       compile(name: 'cardview-v7-23.4.0', ext:'aar')
       compile(name: 'common', ext:'aar')
       compile(name: 'facebook-android-sdk-4.23.0', ext:'aar')
       compile(name: 'facebook-android-wrapper-7.10.0', ext:'aar')
       compile(name: 'play-services-ads-10.0.1', ext:'aar')
       compile(name: 'play-services-auth-10.0.1', ext:'aar')
       compile(name: 'play-services-auth-base-10.0.1', ext:'aar')
       compile(name: 'play-services-base-10.0.1', ext:'aar')
       compile(name: 'play-services-basement-10.0.1', ext:'aar')
       compile(name: 'play-services-drive-10.0.1', ext:'aar')
       compile(name: 'play-services-games-10.0.1', ext:'aar')
       compile(name: 'play-services-iid-10.0.1', ext:'aar')
       compile(name: 'play-services-nearby-10.0.1', ext:'aar')
       compile(name: 'play-services-tasks-10.0.1', ext:'aar')
       compile(name: 'support-v4-24.0.0', ext:'aar')
       compile project(':Etcetera_lib')
       compile project(':Flurry_lib')
       compile project(':MainLibProj')
       compile project(':PermissionCheckPlugin')
       compile project(':SwrvePush_lib')
       compile project(':fyber-unityads-1.5.6-r3')
       compile project(':unity-android-resources') // &lt;- possible cause of error
  }
  </code></pre>
  
  <p>Thanks for any help guys.</p>