googleads / googleads-mobile-unity

Official Unity Plugin for the Google Mobile Ads SDK
https://developers.google.com/admob/unity
Apache License 2.0
1.37k stars 1.08k forks source link

Build iOS failed: Undefined symbols for architecture arm64: "_GADURequestInterstitial" #1616

Closed blue7un closed 3 years ago

blue7un commented 3 years ago

Steps to reproduce:

=> Create empty Unity project => Copy sample HelloWorld to Assets folder => Update Admob appId => Use original iOS Resolver Settings (enable use_frameworks! + enable Always add the main target) => Build to Xcode => Build using Xcode

Changing iOS Resolver Settings gives same result:

mdobele commented 3 years ago

I'm currently having the same issue. I've been unable to get Admob v6.0.0 to link on iOS. I've tried both a blank new project using the HelloWorld example (as described above) as well as my own game project that was previously using Admob v5.4.0. Using Unity 2020.3.6f1 and XCode 12.5.

devolzhas commented 3 years ago

The same problem.

hazker commented 3 years ago

I'm currently having the same problem.

pezezzle commented 3 years ago

same problem.

ironnick commented 3 years ago

same problem

unity 2019.4.22f1 xcode 12.4

olpero commented 3 years ago

Same problem here and it is a huge issue for us.

qbit86 commented 3 years ago

@JillSong Similar issue on Unity 2018.4.10f1:

Undefined symbols for architecture armv7:
  "_GADURequestInterstitial", referenced from:
      _Externs_GADURequestInterstitial_m7354DBBE6F0E4C60EFEE0EC733AAEC22D91E2B0C in Bulk_GoogleMobileAds.iOS_0.o
     (maybe you meant: _Externs_GADURequestInterstitial_m7354DBBE6F0E4C60EFEE0EC733AAEC22D91E2B0C)
ld: symbol(s) not found for architecture armv7
Almightix commented 3 years ago

same problem

unity 2020.2.6f1 xcode 12.5

qbit86 commented 3 years ago

@blue7un Okay, I'm going to try adding GADU*-files from source/plugin/Assets/Plugins/iOS to Assets/Plugins/iOS/.

onom88 commented 3 years ago

Same problem. Any fix?

qbit86 commented 3 years ago

I'm going to try adding GADU*-files from source/plugin/Assets/Plugins/iOS to Assets/Plugins/iOS/

This results in a lot of duplicate symbol errors. Perhaps I should only add header h-files, not implementation m-files to avoid clash with unity-plugin-library.a.

qbit86 commented 3 years ago

@JillSong What is GADURequestInterstitial()? It is not referenced anywhere.

[DllImport("__Internal")]
internal static extern void GADURequestInterstitial(IntPtr interstitial, IntPtr request);

source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs#L271 It used to be implemented in source\plugin\Assets\Plugins\iOS\GADUInterface.m, but it's not there anymore. Seems like it was replaced with GADULoadInterstitialAd().

jungletree commented 3 years ago

The following function is not implemented in unity-plugin-library.a. I checked it with IDA.

[DllImport("__Internal")]
internal static extern void GADURequestInterstitial(IntPtr interstitial, IntPtr request);

This function was not used anymore in admob 6.0. To fix this link error, you could remove any code that call it. Or just add a place holder function, as following:

void GADURequestInterstitial(intptr_t interstitial, intptr_t request) { }
kristofgiber commented 3 years ago

Same problem. We're downgrading to 5.4 until this is fixed. Sounds like the sort of bug they'd have noticed if they'd just built it once for the latest Unity LTS (2020 LTS).

vincentborcard commented 3 years ago

@jungletree Can I ask where to put the place holder function ?

dom98111 commented 3 years ago

Hi! The same problem. How to fix it?

onom88 commented 3 years ago

The following function is not implemented in unity-plugin-library.a. I checked it with IDA.

[DllImport("__Internal")]
internal static extern void GADURequestInterstitial(IntPtr interstitial, IntPtr request);

This function was not used anymore in admob 6.0. To fix this link error, you could remove any code that call it. Or just add a place holder function, as following:

void GADURequestInterstitial(intptr_t interstitial, intptr_t request) { }

Would like to ask where to put this function "void GADURequestInterstitial(intptr_t interstitial, intptr_t request) { }"

onom88 commented 3 years ago

I'm going to try adding GADU*-files from source/plugin/Assets/Plugins/iOS to Assets/Plugins/iOS/

This results in a lot of duplicate symbol errors. Perhaps I should only add header h-files, not implementation m-files to avoid clash with unity-plugin-library.a.

May I ask if you've had some luck?

bigyo-fourdesire commented 3 years ago

same problem Unity 2020.3.6f1 Xcode 12.5

lucianocheng commented 3 years ago

I was able to get around this by commenting out line 7897 in Classes\Native\GoogleMobileAds.iOS.cpp in XCode:

reinterpret_cast<PInvokeFunc>(GADURequestInterstitial)(___interstitial0, ___request1);

This looks like the casting / native invocation of the GADURequestInterstitial function. Without this invocation, the compiler shouldn't look for it.

Note that this code looks auto-generated, so it may not appear consistently on line 7897.

Also note that I don't use interstitials in my code, so I'm not sure if this disables interstitials entirely or not. It may be more correct to implement the function as indicated by @jungletree above.

onom88 commented 3 years ago

I was able to get around this by making the following changes to Classes\Native\GoogleMobileAds.iOS.cpp in XCode:

  1. Comment out this on line 7891:
System.Void GoogleMobileAds.iOS.Externs::GADURequestInterstitial(System.IntPtr,System.IntPtr)
  1. Comment out this on line 7897:
reinterpret_cast<PInvokeFunc>(GADURequestInterstitial)(___interstitial0, ___request1);

Note that I don't use interstitials in my code, so I'm not sure if this disables interstitials entirely or not. It may be more correct to implement the function as indicated by @jungletree above.

Hi, may I ask where to put the function "void GADURequestInterstitial(intptr_t interstitial, intptr_t request) { }" ? Should I put it in a script in unity? Can you please guide me where I should? Or should I put it in xcode?

lucianocheng commented 3 years ago

I was able to get around this by making the following changes to Classes\Native\GoogleMobileAds.iOS.cpp in XCode:

  1. Comment out this on line 7891:
System.Void GoogleMobileAds.iOS.Externs::GADURequestInterstitial(System.IntPtr,System.IntPtr)
  1. Comment out this on line 7897:
reinterpret_cast<PInvokeFunc>(GADURequestInterstitial)(___interstitial0, ___request1);

Note that I don't use interstitials in my code, so I'm not sure if this disables interstitials entirely or not. It may be more correct to implement the function as indicated by @jungletree above.

Hi, may I ask where to put the function "void GADURequestInterstitial(intptr_t interstitial, intptr_t request) { }" ?

To implement my solution, I did not put this function. I just commented out the reinterpret_cast<PInvokeFunc> line.

Should I put it in a script in unity? Can you please guide me where I should? Or should I put it in xcode?

XCode.

qbit86 commented 3 years ago

@onom88

Would like to ask where to put this function "void GADURequestInterstitial(intptr_t interstitial, intptr_t request) { }"

I've created a file Assets/Plugins/iOS/Workaround.m with the following definitions:

#import <GoogleMobileAds/GoogleMobileAds.h>
#import "GADUTypes.h"

// Workaround for https://github.com/googleads/googleads-mobile-unity/issues/1616

void GADURequestInterstitial(GADUTypeInterstitialRef interstitial, GADUTypeRequestRef request) { }

void GADURequestRewardedAd(GADUTypeRewardedAdRef rewardedAd, GADUTypeRequestRef request) { }

I have also added file source/plugin/Assets/Plugins/iOS/GADUTypes.h and other headers nearby from this repository to Assets/Plugins/iOS/

onom88 commented 3 years ago

@onom88

Would like to ask where to put this function "void GADURequestInterstitial(intptr_t interstitial, intptr_t request) { }"

I've created a file Assets/Plugins/iOS/Workaround.m with the following definitions:

#import <GoogleMobileAds/GoogleMobileAds.h>
#import "GADUTypes.h"

// Workaround for https://github.com/googleads/googleads-mobile-unity/issues/1616

void GADURequestInterstitial(GADUTypeInterstitialRef interstitial, GADUTypeRequestRef request) { }

void GADURequestRewardedAd(GADUTypeRewardedAdRef rewardedAd, GADUTypeRequestRef request) { }

I have also added file source/plugin/Assets/Plugins/iOS/GADUTypes.h and other headers nearby from this repository to Assets/Plugins/iOS/

May I ask what are the other headers needed? i'm sorry im a super beginner in using xcode. In my game, im only using banner ads and interstitial ads. Should I also add all files with the word interstitial? from this link

Thank you so much for your help!

Last8Exile commented 3 years ago

@lucianocheng, thanks. After commenting out this line: build succeded and ads working.

7897: reinterpret_cast(GADURequestInterstitial)(interstitial0, request1);

qbit86 commented 3 years ago

@onom88

May I ask what are the other headers needed?

Looks like it's enough to add just only Assets/Plugins/iOS/GADUTypes.h, but I added all of the headers from this directory, just in case.

im a super beginner in using xcode.

I'm not an Xcode user either :) More over I'm sitting on Windows, and make iOS-packages with our build server.

All these manipulations don't require additional steps in Xcode — just drop Assets\Plugins\iOS\Workaround.m and Assets\Plugins\iOS\GADUTypes.h to your Unity-project.

qbit86 commented 3 years ago

@onom88 It would probably be sufficient to reduce Assets/Plugins/iOS/Workaround.m to just this, with no headers needed at all:

// Workaround for https://github.com/googleads/googleads-mobile-unity/issues/1616

typedef const void *GADUTypeInterstitialRef;

typedef const void *GADUTypeRewardedAdRef;

typedef const void *GADUTypeRequestRef;

void GADURequestInterstitial(GADUTypeInterstitialRef interstitial, GADUTypeRequestRef request) { }

void GADURequestRewardedAd(GADUTypeRewardedAdRef rewardedAd, GADUTypeRequestRef request) { }
onom88 commented 3 years ago

@onom88 It would probably be sufficient to reduce Assets/Plugins/iOS/Workaround.m to just this, with no headers needed at all:

// Workaround for https://github.com/googleads/googleads-mobile-unity/issues/1616

typedef const void *GADUTypeInterstitialRef;

typedef const void *GADUTypeRewardedAdRef;

typedef const void *GADUTypeRequestRef;

void GADURequestInterstitial(GADUTypeInterstitialRef interstitial, GADUTypeRequestRef request) { }

void GADURequestRewardedAd(GADUTypeRewardedAdRef rewardedAd, GADUTypeRequestRef request) { }

Thank you so much! you're a life saver!

jungletree commented 3 years ago

The following function is not implemented in unity-plugin-library.a. I checked it with IDA.

[DllImport("__Internal")]
internal static extern void GADURequestInterstitial(IntPtr interstitial, IntPtr request);

This function was not used anymore in admob 6.0. To fix this link error, you could remove any code that call it. Or just add a place holder function, as following:

void GADURequestInterstitial(intptr_t interstitial, intptr_t request) { }

Would like to ask where to put this function "void GADURequestInterstitial(intptr_t interstitial, intptr_t request) { }"

Hi, you need to create .mm file in your xcode project, add the following code in this file:

#include <stdlib.h>

#ifdef __cplusplus 
extern "C" { 
#endif
void GADURequestInterstitial(intptr_t interstitial, intptr_t request) { }
#ifdef __cplusplus 
} 
#endif  

This will make the linker tool find symbol GADURequestInterstitial.

jungletree commented 3 years ago

The following function is not implemented in unity-plugin-library.a. I checked it with IDA.

[DllImport("__Internal")]
internal static extern void GADURequestInterstitial(IntPtr interstitial, IntPtr request);

This function was not used anymore in admob 6.0. To fix this link error, you could remove any code that call it. Or just add a place holder function, as following:

void GADURequestInterstitial(intptr_t interstitial, intptr_t request) { }

Would like to ask where to put this function "void GADURequestInterstitial(intptr_t interstitial, intptr_t request) { }"

Hi, you need to create .mm file in your xcode project, add the following code in this file:

#include <stdlib.h>

#ifdef __cplusplus 
extern "C" { 
#endif
void GADURequestInterstitial(intptr_t interstitial, intptr_t request) { }
#ifdef __cplusplus 
} 
#endif  

This will make the linker tool find symbol GADURequestInterstitial.

Hi, if you do a source code compare between Admob v5.4 and Admob 6.0, you will find that GADURequestInterstitial was replaced by another function called GADULoadInterstitialAd. But for admob 6.0, the dllImport for GADURequestInterstitial still exists. So you could just comment it. Or add a place holder function to fake the missing symbol.

JillSong commented 3 years ago

@jungletree Thanks for explaining the problem.

We changed how we package the plugin for v6.0, and the issue lies in the dll build, not in the source code. So please import our source code instead of the unity package for now. We will release the fix soon.

kamal-ik commented 3 years ago

Hi, I am getting this same error, I am new to unity, So please let me know how can I import source code instead of the unity package? Thanks

mcolombo commented 3 years ago

Hi, I am getting this same error, I am new to unity, So please let me know how can I import source code instead of the unity package? Thanks

Hey Kamal, I faced this exact same issue yesterday. I fixed it doing the Workaround.m done by @onom88.

If you want to add the code directly (didn't try that myself), download de zip file, navigate it to source/plugin/Assets and you should add all that to your project.

cheers!

kamal-ik commented 3 years ago

Hi, I am getting this same error, I am new to unity, So please let me know how can I import source code instead of the unity package? Thanks

Hey Kamal, I faced this exact same issue yesterday. I fixed it doing the Workaround.m done by @onom88.

If you want to add the code directly (didn't try that myself), download de zip file, navigate it to source/plugin/Assets and you should add all that to your project.

cheers!

Thank you for your help

newlifehejian commented 3 years ago

@JillSong hi, I've the same issue, and I tried sourcecode too, but still can't build in xcode. following is the error message from xode. is there any update on the unity package?

Arm64 function not 4-byte aligned: _unwind_tester from /Users/kevin/Documents/workspace/piu_xcode/submit/Libraries/libiPhone-lib.a(unwind_test_arm64.o)

Undefined symbol: _kGADAdLoaderAdTypeUnifiedNative

Undefined symbol: _OBJCCLASS$_DFPInterstitial

Undefined symbol: _OBJCCLASS$_DFPRequest

Undefined symbol: _OBJCCLASS$_DFPBannerView

Undefined symbol: _OBJCCLASS$_GADRewardBasedVideoAd

Undefined symbol: _OBJCCLASS$_GADRequestError

Undefined symbol: _OBJCCLASS$_GADUnifiedNativeAd

Undefined symbol: _OBJCCLASS$_GADInterstitial

Undefined symbol: _GADURequestInterstitial

KrKgg commented 3 years ago

@JillSong Hello, I think we need to have a full release version to fix this.

Bellkross commented 3 years ago

@onom88 It would probably be sufficient to reduce Assets/Plugins/iOS/Workaround.m to just this, with no headers needed at all:

// Workaround for https://github.com/googleads/googleads-mobile-unity/issues/1616

typedef const void *GADUTypeInterstitialRef;

typedef const void *GADUTypeRewardedAdRef;

typedef const void *GADUTypeRequestRef;

void GADURequestInterstitial(GADUTypeInterstitialRef interstitial, GADUTypeRequestRef request) { }

void GADURequestRewardedAd(GADUTypeRewardedAdRef rewardedAd, GADUTypeRequestRef request) { }

Same issue. Worked for me, thank you!

JillSong commented 3 years ago

Closing the issue. The fix will be in the next release.

SRubioMiranda commented 3 years ago

Still not fixed. Tested with Admob Unity Plugin v.6.0.1

mnplays commented 3 years ago

Same problem here with

JillSong commented 3 years ago

@mnplays Could you verify if you have deleted the entire old plugin and re-import 6.0.1?

Let us know if the problem persists, thanks!

SRubioMiranda commented 3 years ago

Still not working :( We tried a bunch of things, but we are not getting results

We deleted all old files, and Plugins/iOS folder, reimported Admob 6.0.1 and we still have the same issue. I will try to give you more details:

  1. We cleaned project from previous Admob version (we deleted everything under Plugins/iOS)
  2. We imported the new unitypackages (Admob 6.0.1 and ad networks, listed below)
  3. Failure to compile in xcode expects a reference in the VungleExtrasBuilder class (GADUAdNetworkExtras.h file not found) screenshot1
  4. We copied the required file (GADUAdNetworkExtras.h) to Plugins/iOS folder, getting it from a previous Admob version (5.4.0)
  5. Compile again and get a new error screenshot2

Used versions XCode 12.5 Unity 2019.4.25f1 Admob 6.0.1 (20.1.0) Vungle 3.6.0 (6.9.1.1 Android, 6.9.2.0 iOS) AppLovin 5.0.0 (10.1.2.0 Android, 10.2.1.0) UnityAds 2.7.0 (3.7.1.0 Android & iOS) Facebook 3.3.0 (6.4.0.0 Android, 6.4.1.0 iOS) AdColony 2.0.3 (4.1.4.1 Android, 4.1.5.0 iOS)

Any idea?

kamal-ik commented 3 years ago

I also tried 6.0.1 on now seems it's not yet fixed, you are using "GADRewardedAdDelegate" instead of GADFullScreenContentDelegate Would you please update the ios plugin to support latest AdMob SDK
Screenshot 2021-07-01 at 7 46 53 PM

murilobast commented 3 years ago

Still not working :( We tried a bunch of things, but we are not getting results

We deleted all old files, and Plugins/iOS folder, reimported Admob 6.0.1 and we still have the same issue. I will try to give you more details:

  1. We cleaned project from previous Admob version (we deleted everything under Plugins/iOS)
  2. We imported the new unitypackages (Admob 6.0.1 and ad networks, listed below)
  3. Failure to compile in xcode expects a reference in the VungleExtrasBuilder class (GADUAdNetworkExtras.h file not found) screenshot1
  4. We copied the required file (GADUAdNetworkExtras.h) to Plugins/iOS folder, getting it from a previous Admob version (5.4.0)
  5. Compile again and get a new error screenshot2

Used versions XCode 12.5 Unity 2019.4.25f1 Admob 6.0.1 (20.1.0) Vungle 3.6.0 (6.9.1.1 Android, 6.9.2.0 iOS) AppLovin 5.0.0 (10.1.2.0 Android, 10.2.1.0) UnityAds 2.7.0 (3.7.1.0 Android & iOS) Facebook 3.3.0 (6.4.0.0 Android, 6.4.1.0 iOS) AdColony 2.0.3 (4.1.4.1 Android, 4.1.5.0 iOS)

Any idea?

I had the same issue with 6.0.0 and 6.0.1 are you using AdColony mediation? I had to remove AdColony to be able to build the project, looks like it's not compatible with the newest version of this plugin. In the other hand, if I downgrade to 5.4.0, AdColony works but AppLovin stops working because the newest version of AppLovin plugin requires GoogleMobileAds 8.0+ and the pod server for the old versions is down.

kamal-ik commented 3 years ago

I had the same issue 6.0.1 with AdColony mediation (2.0.3) with "GADUAdNetworkExtras" file not found And I had removed AdColony from my project

murilobast commented 3 years ago

I had the same issue 6.0.1 with AdColony mediation (2.0.3) with "GADUAdNetworkExtras" file not found And I had removed AdColony from my project

Not the optimal solution since one less mediation network can affect ads income. But this was the only way I could build the game. Let's hope it gets fixed soon

murilobast commented 3 years ago

To anyone having issues with AdColony Mediation.

TarmoJussila commented 3 years ago

To anyone having issues with AdColony Mediation.

  • Make a backup of your GoogleMobileAdsSettings.asset file
  • Delete the GoogleMobileAds folder
  • Delete all google ads relate files in the Plugins/iOS and Plugins/Android folder
  • Install 6.0.1
  • Install all your Mediation network packages (AdColony included)
  • In the editor, go to Assets -> External Dependency Manager -> iOS Resolver -> Settings
  • Enable "Link frameworks statically"
  • Restore your backed up GoogleMobileAdsSettings.asset file
  • IMPORTANT go to releases and download the 6.0.1 source code
  • Grab the GADUAdNetworkExtras.h file from source/plugin/Assets/Plugins/iOS and paste it into Plugins/iOS
  • Build should work now

Can confirm that this solution solved the issue with Vungle as well. Same issue that was presented with AdColony it seems ("GADUAdNetworkExtras" file not found).

However, although the build now succeeds, the game crashes after launch with this error:

Thread 53: “+[GADRequest sdkVersion]: unrecognized selector sent to class 0x10cdd1f00”

I'm using Xcode 12.4.0, Unity 2091.4.16f1 and AdMob 6.0.1 with latest compatible mediation adapters.

mertkaman commented 2 years ago

Hi , i had same problem. Before build, i deleted iOS and Android folders in Plugins folder in Unity. For me that was the problem, i undelete these two folders and problem gone. Hope helps.

VikramVilasagaram commented 2 years ago

Updating the new version GoogleMobileAds package in Unity resolved my issue.