Unity 5.5.1 / 5.5.2 build issues

We try to export Unity3D project and try to build using GRADLE. We use Unity3d 5.5.1, 5.5.2 and following sdk’s:

  • AWS,
  • GooglePlay,
  • Facebook, Upsight,
  • IAP,
  • Tenjin,
  • UnityAndroidExtras.

During building process following errors occur:

  • com.android.build.api.transform.TransformException:
  • java.util.zip.ZipException: duplicate entry:
  • com/cherrypickgames/myhospital/BuildConfig.class

We tried to exclude:

  • exclude group: ‘com.google.firebase’, module: ‘firebase-common’
  • exclude group: ‘com.google.firebase’, module: ‘firebase-core’
  • exclude group: ‘com.google.firebase’, module: ‘firebase-iid’
  • exclude group: ‘support-v4’
  • exclude group: ‘com.android.support’

We tried to delete:

  • dagger
  • gson
  • io-commons
  • javax
  • mopub-volley
  • otto
  • rxjava
  • support-annotations

As a result, we are unable to export and build our project.

Hi Rafal,

Could you provide a bit more information regarding what version of Gradle you are using and which Android plugin you are applying? If you could give us an build scan, it would be a lot easier to debug as it contains all the required information.

Daniel

Hi Daniel,

please find enclosed link to our build scan.

https://scans.gradle.com/s/vsgepbjfom7g2

Thank you very much for your help.

Rafal

From the build scan and reading online about your specific errors, it seems the errors is related to how your build is configured. Maybe having a look at this stackoverflow question would help get over your failure.

Hi Daniel,

thank you for your reply. Maybe you’ve got a different solution for us? One from the link doesn’t work in our case.

Rafal

I had the same issue.

The fix was to put packageBuildConfig = false in the android { ... } section of the build.gradle files for each library project:

android {
	packageBuildConfig = false
...

Even if it’s been depreceated it still working.

Jean,

thank you. I will try your solution ASAP and let you know if it works for us.

Thx for help.

You can do it easily by modifying the libTemplate.gradle file directly inside your Unity install:

…/PlaybackEngines/AndroidPlayer/Tools/GradleTemplates/libTemplate.gradle