Search Issue Tracker

By Design

Votes

2

Found in

2021.1.0a6

2021.1.7f1

2021.2

Issue ID

1338777

Regression

Yes

[Android] Could not build an IL2CPP project when using 'GoogleMobileAds.dll'

Mobile

-

How to reproduce it:
1. Open the user's attached project
2. Go to the Project Settings -> Player and set Scripting Backend value to "IL2CPP"
3. Build the project
4. Observe the Console window

Expected results: Building for Android with IL2CPP succeeds
Actual results: Building for Android with IL2CPP fails. The exception appears in the Console window:
Fatal error in Unity CIL Linker
Mono.Linker.LinkerFatalErrorException: ILLink: error IL1005: GoogleMobileAds.Api.MobileAds.GetClientFactory(): Error processing method 'GoogleMobileAds.Api.MobileAds.GetClientFactory()' in assembly 'GoogleMobileAds.dll'

Reproducible with: 2021.1.0a6, 2021.1.11f1, 2021.2.0a20
Not reproducible with: 2020.3.12f1, 2021.1.0a5
Could not test with: 2018.4.36f1, 2019.4.28f1

Comments (9)

  1. Evgeno

    Feb 01, 2023 18:51

    The problem is present in Unity 2022.2.4f1

  2. protoCorey

    Jan 24, 2023 05:48

    This seems to appear in 2022.2.2f1 and 2022.2.3f1, it does NOT happen in 2022.2.1f1 (retested this after failing the other 2 builds). If I build with 2022.2.1f1 and THEN with 2022.2.3f (without deleting the library folder) I get past this first error on to the

    .../Library/Bee/artifacts/Android/il2cppOutput/cpp/GoogleMobileAds.iOS.cpp:7684: undefined reference to GADUGetAdErrorCode

    error that is mentioned in https://github.com/googleads/googleads-mobile-unity/issues/1613

    the link.xml workaround does not work. currently trying to delete the IOS dll manually (though, this would mean we need a manual build and can't use our build chain)

  3. hippogames

    Oct 25, 2022 10:23

    The error stil present in 2022.1.20. The fix with link.xml removes the first error but not other like
    GoogleMobileAds.iOS.cpp:8206: error: undefined reference to 'GADUGetAdErrorCode'
    (while builing on Android btw)

  4. gothicserpent

    Oct 10, 2022 00:08

    Once I downgraded from `Unity 2022.1.19f1` to `Unity 2021.3.11f1` it worked.

    I hope someone resolves this for the `Unity 2022` builds. Please keep working on this to ensure it's not there in our next versions!

  5. a-dibacco

    Sep 04, 2022 16:02

    @JoshPeterson suggestion works fine but other errors pop up:

    Building Library\Bee\artifacts\Android\iz17e\libil2cpp.so failed with output:
    C:/Users/adiba/Documents/Apps/UnityProjects/LettersTracingClassic_174_a/Library/Bee/artifacts/Android/il2cppOutput/cpp/GoogleMobileAds.iOS.cpp:7746: error: undefined reference to 'GADUGetAdErrorCode'
    C:/Users/adiba/Documents/Apps/UnityProjects/LettersTracingClassic_174_a/Library/Bee/artifacts/Android/il2cppOutput/cpp/GoogleMobileAds.iOS.cpp:7746: error: undefined reference to 'GADUGetAdErrorCode'
    C:/Users/adiba/Documents/Apps/UnityProjects/LettersTracingClassic_174_a/Library/Bee/artifacts/Android/il2cppOutput/cpp/GoogleMobileAds.iOS.cpp:7756: error: undefined reference to 'GADUGetAdErrorDomain'
    C:/Users/adiba/Documents/Apps/UnityProjects/LettersTracingClassic_174_a/Library/Bee/artifacts/Android/il2cppOutput/cpp/GoogleMobileAds.iOS.cpp:7756: error: undefined reference to 'GADUGetAdErrorDomain'
    C:/Users/adiba/Documents/Apps/UnityProjects/LettersTracingClassic_174_a/Library/Bee/artifacts/Android/il2cppOutput/cpp/GoogleMobileAds.iOS.cpp:7774: error: undefined reference to 'GADUGetAdErrorMessage'
    C:/Users/adiba/Documents/Apps/UnityProjects/LettersTracingClassic_174_a/Library/Bee/artifacts/Android/il2cppOutput/cpp/GoogleMobileAds.iOS.cpp:7774: error: undefined reference to 'GADUGetAdErrorMessage'

  6. a-dibacco

    Sep 04, 2022 10:54

    I confirm that the error is preset with Unity 2022.1.15f1 and GoogleMobileAds 7.1.0

  7. a-dibacco

    Sep 03, 2022 20:54

    I put the file link.xml into Assets and into GooglePlayMobileAds (ver 7.1.0) but I still have this problem:

    Mono.Linker.LinkerFatalErrorException: ILLink: error IL1005: GoogleMobileAds.Api.MobileAds.GetClientFactory(): Error processing method 'GoogleMobileAds.Api.MobileAds.GetClientFactory()' in assembly 'GoogleMobileAds.dll'

  8. cyborgjinx

    Sep 02, 2022 21:43

    Error still present in 2022.1.15f1

  9. JoshPeterson

    Aug 29, 2022 11:38

    In case anyone comes across this issue - you can work around it by adding this link.xml to the project:

    <assembly fullname="GoogleMobileAds.Unity" ignoreIfMissing="1" preserve="nothing">
    </assembly>

    In addition, this error seems to be corrected in the Google Ads Mobile side: https://github.com/googleads/googleads-mobile-unity/pull/1647

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.