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.
Daniel_L
(Daniel Lacasse)
March 24, 2017, 1:50pm
2
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
Daniel_L
(Daniel Lacasse)
March 31, 2017, 7:21pm
4
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
Jean
(Meyblum)
April 7, 2017, 6:04am
6
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.
Jean
(Meyblum)
April 12, 2017, 7:53pm
8
You can do it easily by modifying the libTemplate.gradle file directly inside your Unity install:
…/PlaybackEngines/AndroidPlayer/Tools/GradleTemplates/libTemplate.gradle