Search Unity

[Android] Unity Cloud Build started failing build today [Solved -> FB SDK issue]

Discussion in 'Unity Build Automation' started by xVergilx, Jan 22, 2020.

  1. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Got a weird issue with cloud build, build fails with the following exception:
    Code (CSharp):
    1. FAILURE: Build failed with an exception.
    2. 301: [Unity] ERROR:
    3. 302: [Unity] ERROR: * What went wrong:
    4. 303: [Unity] ERROR: Execution failed for task ':checkReleaseDuplicateClasses'.
    5. 304: [Unity] ERROR: > 1 exception was raised by workers:
    6. 305: [Unity] ERROR:   java.lang.RuntimeException: Duplicate class com.android.installreferrer.BuildConfig found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    7. 306: [Unity]   java.lang.RuntimeException: Duplicate class com.android.installreferrer.BuildConfig found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    8. 307: [Unity] ERROR:   Duplicate class com.android.installreferrer.api.InstallReferrerClient found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    9. 308: [Unity] ERROR:   Duplicate class com.android.installreferrer.api.InstallReferrerClient$1 found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    10. 309: [Unity] ERROR:   Duplicate class com.android.installreferrer.api.InstallReferrerClient$Builder found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    11. 310: [Unity] ERROR:   Duplicate class com.android.installreferrer.api.InstallReferrerClient$InstallReferrerResponse found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    12. 311: [Unity] ERROR:   Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    13. 312: [Unity] ERROR:   Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl$1 found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    14. 313: [Unity] ERROR:   Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl$ClientState found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    15. 314: [Unity] ERROR:   Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl$InstallReferrerServiceConnection found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    16. 315: [Unity] ERROR:   Duplicate class com.android.installreferrer.api.InstallReferrerStateListener found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    17. 316: [Unity] ERROR:   Duplicate class com.android.installreferrer.api.ReferrerDetails found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    18. 317: [Unity] ERROR:   Duplicate class com.android.installreferrer.commons.InstallReferrerCommons found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    19. 318: [Unity] ERROR:   Duplicate class com.google.android.finsky.externalreferrer.IGetInstallReferrerService found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    20. 319: [Unity] ERROR:   Duplicate class com.google.android.finsky.externalreferrer.IGetInstallReferrerService$Stub found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    21. 320: [Unity] ERROR:   Duplicate class com.google.android.finsky.externalreferrer.IGetInstallReferrerService$Stub$Proxy found in modules classes.jar (:com.android.installreferrer.installreferrer-1.1:) and classes.jar (:installreferrer-1.0:)
    This started happening today. I'm not really sure what's causing this. Since nothing has changed in the dependencies setup (it is set to auto-resolve on build though).

    - Yesterday I was able to build this project;
    - Only two commits with prefabs + .cs code were made since;
    - I've tried clean build, same result;
    - Tried raising Unity version from 2019.2.11f -> 2019.2.16f, same result;
    - Local build builds just fine, both APK + ARMv7 / ARMv64 and AAB.

    Unfortunately, exception is not really useful, any ideas what can be causing this?
     
  2. dirty-rectangle

    dirty-rectangle

    Joined:
    Apr 23, 2015
    Posts:
    78
    i'm seeing the same, it looks to be as a result of this fb lib version auto updating

    before:
    [Unity] Extracting Assets/Plugins/Android/com.facebook.android.facebook-share-5.13.0.aar ()

    after:
    [Unity] Extracting Assets/Plugins/Android/com.facebook.android.facebook-share-5.15.0.aar ()


    it should be possible to lock the version to prevent this update by setting the config in FacebookSDK/Plugins/Editor/Dependencies.xml
     
    ortin and xVergilx like this.
  3. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Do you have a working solution? I've got no idea what version of libraries it was prior for those.

    Here's whats in dependencies:
    Code (CSharp):
    1. <androidPackages>
    2.         <androidPackage spec="com.parse.bolts:bolts-android:1.4.0" />
    3.         <androidPackage spec="com.facebook.android:facebook-core:[5,6)" />
    4.         <androidPackage spec="com.facebook.android:facebook-applinks:[5,6)" />
    5.         <androidPackage spec="com.facebook.android:facebook-login:[5,6)" />
    6.         <androidPackage spec="com.facebook.android:facebook-share:[5,6)" />
    7.     </androidPackages>
    Edit: Right, they all were 5.13.0. Interesting. Need to find a way to lock to 5.13 though.
    Edit 2: Alright, its straight forward and I'm blind. Just putting version like bolts specify it does the trick for the resolver.
    Still need to test if this works on the cloud.
     
    Last edited: Jan 22, 2020
    BravoCowen and ageana like this.
  4. dirty-rectangle

    dirty-rectangle

    Joined:
    Apr 23, 2015
    Posts:
    78
    Making this config edit has fixed the build error for me.
    <androidPackage spec="com.facebook.android:facebook-core:[5,5.13)" />
    <androidPackage spec="com.facebook.android:facebook-applinks:[5,5.13)" />
    <androidPackage spec="com.facebook.android:facebook-login:[5,5.13)" />
    <androidPackage spec="com.facebook.android:facebook-share:[5,5.13)" />
     
    Razeoryuno, yuliyF, Viciousu and 4 others like this.
  5. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
  6. unity2

    unity2

    Joined:
    Jan 10, 2013
    Posts:
    23
    Guys, I was also facing the same issue since yesterday and able to make the build by making changes you suggested. Thanks for your help. But I was wondering how you solved this issue. How you come into this conclusion that this could be a culprit? In my case my dependencies files were same throughout my project and that was [5,6) and never get changed. How you debug this type of issues?
     
  7. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    That's probably because your libraries aren't stored as part of the project and taken from gradle upon build.
    Force resolving though changed my gradle as well as libraries in git repo.

    But to be honest, if not @dirty-rectangle I probably woudn't even had a clue where to look at.
     
  8. andersemil

    andersemil

    Joined:
    Feb 2, 2015
    Posts:
    112
    Not the same error message, but same problem here ... @dirty-rectangle s hack did the trick. Thanks!
     
  9. DivinosDev

    DivinosDev

    Joined:
    Apr 23, 2019
    Posts:
    1
    Thank you @dirty-rectangle!! This error was driving me crazy for two days now as it seemingly came out of nowhere. Thank you so much man!
     
    dirty-rectangle likes this.
  10. Deleted User

    Deleted User

    Guest

    @dirty-rectangle I get this error can you please help

    What went wrong:
    Execution failed for task ':checkReleaseDuplicateClasses'.
    > 1 exception was raised by workers:
    java.lang.RuntimeException: Duplicate class com.android.installreferrer.BuildConfig found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)
    Duplicate class com.android.installreferrer.api.InstallReferrerClient found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)
    Duplicate class com.android.installreferrer.api.InstallReferrerClient$1 found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)
    Duplicate class com.android.installreferrer.api.InstallReferrerClient$Builder found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)
    Duplicate class com.android.installreferrer.api.InstallReferrerClient$InstallReferrerResponse found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)
    Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)
    Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl$1 found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)
    Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl$ClientState found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)
    Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl$InstallReferrerServiceConnection found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)
    Duplicate class com.android.installreferrer.api.InstallReferrerStateListener found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)
    Duplicate class com.android.installreferrer.api.ReferrerDetails found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)
    Duplicate class com.android.installreferrer.commons.InstallReferrerCommons found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)
    Duplicate class com.google.android.finsky.externalreferrer.IGetInstallReferrerService found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)
    Duplicate class com.google.android.finsky.externalreferrer.IGetInstallReferrerService$Stub found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)
    Duplicate class com.google.android.finsky.externalreferrer.IGetInstallReferrerService$Stub$Proxy found in modules classes.jar :)com.android.installreferrer.installreferrer-1.0:) and classes.jar :)installreferrer-1.0:)

    Go to the documentation to learn how to Fix dependency resolution errors.
     
  11. martingonzalezetermax

    martingonzalezetermax

    Joined:
    Dec 11, 2017
    Posts:
    24
    Same here after upgrading facebook to 7.19.2
     
  12. dirty-rectangle

    dirty-rectangle

    Joined:
    Apr 23, 2015
    Posts:
    78
    I had Installreferrer-1.0 as part of the AppsFlyerSDK and the jar resolver added com.android.installreferrer.installreferrer-1.0 which created the above conflict. I removed the Installreferrer-1.0 from the AppsFlyerSDk to fix it.
     
  13. martingonzalezetermax

    martingonzalezetermax

    Joined:
    Dec 11, 2017
    Posts:
    24
    That was exactly what i did! Came here and saw your comment XD Nice!
    I'm creating an issue into appsflyer unity sdk to remove it and use the gradle dependency

    https://github.com/AppsFlyerSDK/appsflyer-unity-plugin/issues/5
     
    Last edited: Apr 17, 2020
  14. KREEKS

    KREEKS

    Joined:
    Jan 15, 2021
    Posts:
    1
    Duplicate class com.android.installreferrer.BuildConfig found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)
    Duplicate class com.android.installreferrer.api.InstallReferrerClient found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)
    Duplicate class com.android.installreferrer.api.InstallReferrerClient$1 found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)
    Duplicate class com.android.installreferrer.api.InstallReferrerClient$Builder found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)
    Duplicate class com.android.installreferrer.api.InstallReferrerClient$InstallReferrerResponse found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)
    Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)
    Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl$1 found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)
    Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl$ClientState found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)
    Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl$InstallReferrerServiceConnection found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)
    Duplicate class com.android.installreferrer.api.InstallReferrerStateListener found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)
    Duplicate class com.android.installreferrer.api.ReferrerDetails found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)
    Duplicate class com.android.installreferrer.commons.InstallReferrerCommons found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)
    Duplicate class com.google.android.finsky.externalreferrer.IGetInstallReferrerService found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)
    Duplicate class com.google.android.finsky.externalreferrer.IGetInstallReferrerService$Stub found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)
    Duplicate class com.google.android.finsky.externalreferrer.IGetInstallReferrerService$Stub$Proxy found in modules jetified-installreferrer-1.0-runtime :)installreferrer-1.0:) and jetified-installreferrer-1.0-runtime (com.android.installreferrer:installreferrer:1.0)

    I exported my project from Unity to Buid AAB on android studio, and i am experiencing that problem above. please How do i fix it, thanks
     
  15. vozcn

    vozcn

    Joined:
    May 15, 2019
    Posts:
    11
    I got a similar "Duplicate class"" error after upgrading Facebook SDK from 9.1.0 to 9.2.0.
    Fixed by deleting "facebook-android-wrapper-9.1.0.aar" in folder Assets\FacebookSDK\Plugins\Android\libs
     
    Mobazy likes this.
  16. Kay86X

    Kay86X

    Joined:
    May 9, 2017
    Posts:
    10
    The issue I faced was similar to yours, although the SDK culprit was Facebook SDK. I did just like you said, and the problem is resolved.
     
  17. Lucas_Rybzinski_Pinto

    Lucas_Rybzinski_Pinto

    Joined:
    Dec 2, 2022
    Posts:
    5
    Updating to Facebook SDK 15.1 here.

    I had 3 problems to solve:
    1. "Multiple precompiled assemblies with the same name" and it resolved by deleting the specific duplicate files inside Library/PackageCache in the project. (For me there was 2 files from google.com)

    2. A lot of errors popped after that in the console and I just switched to Android Platform again and it resolved. Then I`ve tried to build the project and got into the 3rd problem below.

    3. "Duplicate class ..." same as the first here in the page. And it resolved by deleting facebook-android-wrapper in folder Assets/FacebookSDK/Plugins/Android/libs exactly as mentioned above.

    It took me half a week to find the solution and this is my contribution. Hope it is easier for you guys.