Search Unity

Cloud Build fails with gradle & FacebookSDK

Discussion in 'Unity Build Automation' started by mrybczynski_hg, Sep 18, 2017.

  1. mrybczynski_hg

    mrybczynski_hg

    Joined:
    Sep 4, 2017
    Posts:
    2
    I'm building apk for Android using Gradle, because of a lot of plugins and dex errors. Locally everything works fine. Even other similar projects builds fine on Cloud Build. On my current project i get 2 errors:

    One with Facebook SDK:
    11316: [Unity] error CS1704: An assembly with the same name `Facebook.Unity.Settings' has already been imported. Consider removing one of the references or sign the assembly

    I found out this topic: https://forum.unity.com/threads/facebook-unity-settings-has-already-been-imported-error.467925/ but fix doesn't work. Strange thing is that it works other projects.

    Another one is about gradle:
    18241: [Unity] FAILURE: Build failed with an exception.
    18242: [Unity] * What went wrong:
    18243: [Unity] Execution failed for task ':transformClassesAndResourcesWithProguardForRelease'.
    18244: [Unity] > java.io.IOException: Please correct the above warnings first.

    18211: [Unity] Note: there were 11 duplicate class definitions.
    18212: [Unity] (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
    18213: [Unity] Warning: com.appsflyer.GcmInstanceIdListener: can't find superclass or interface com.google.android.gms.iid.InstanceIDListenerService
    ...
    18222: [Unity] Warning: com.unity.purchasing.googleplay.GooglePlayPurchasing$6: can't find referenced class com.google.vr.ndk.base.DaydreamApi18227: [Unity] Warning: com.unity.purchasing.googleplay.IabHelper$2$1: can't find referenced class com.google.vr.ndk.base.DaydreamApi
    18228: [Unity] Warning: com.unity.purchasing.googleplay.IabHelper$2$1: can't find referenced class com.google.vr.ndk.base.DaydreamApi
    18232: [Unity] Warning: there were 18 unresolved references to classes or interfaces.
    18233: [Unity] You may need to add missing library jars or update their versions.
    18234: [Unity] If your code works fine without the missing classes, you can suppress
    18235: [Unity] the warnings with '-dontwarn' options.


    18755: [Unity] Note: there were 3 references to unknown classes.
    18758: [Unity] Note: there were 50 unkept descriptor classes in kept class members.
    18762: [Unity] Note: there were 29 library classes explicitly being kept.
    18765: [Unity] Note: there were 17 unresolved dynamic references to classes or interfaces.
    18768: [Unity] Note: there were 1 class casts of dynamically created class instances.
    18772: [Unity] Note: there were 25 accesses to class members by means of introspection.
    18776: [Unity] Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
    18777: [Unity] :transformClassesAndResourcesWithProguardForRelease FAILED
    18778: [Unity] BUILD FAILED

    There is an issue for one of them in Issue Tracker (https://issuetracker.unity3d.com/is...ng-error-about-11-duplicate-class-definitions).
    Do you have any idea how to workaround it? I have no idea how to use proguard and where should I put it's rules.
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Do you have Proguard enabled? probably via a custom gradle build file? it seems that it is not properly configured since the build fails due to Proguard errors (well, technically - warnings...)
     
  3. mrybczynski_hg

    mrybczynski_hg

    Joined:
    Sep 4, 2017
    Posts:
    2
    I have fixed it by using custom gradle build file with minify disabled