5

I recently built my project fine from Unity to Xcode and it ran perfectly well. Since then I have added the Unity ads to my project in Unity (and then realised I no longer need that as it comes inside of unity 5.3 with Services) so I removed the download. However when I built to Xcode I notice 2 Unity Ads in the frameworks that are linked when built. I get this error:

/Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-6D362980BD529555.o /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-498FCC2E7A8DF058.o duplicate symbol _OBJC_CLASS_$_UnityAdsUnityWrapper in: /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-6D362980BD529555.o /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-498FCC2E7A8DF058.o duplicate symbol _OBJC_METACLASS_$_UnityAdsUnityWrapper in: /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-6D362980BD529555.o /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-498FCC2E7A8DF058.o duplicate symbol _UnityAdsCreateNSString in: /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-6D362980BD529555.o /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-498FCC2E7A8DF058.o duplicate symbol _OBJC_IVAR_$_UnityAdsUnityWrapper._gameId in: /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-6D362980BD529555.o /Users/Clive/Library/Developer/Xcode/DerivedData/Unity-iPhone-dprwctphrztswsbrhuqrdbgezzuy/Build/Intermediates/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/UnityAdsUnityWrapper-498FCC2E7A8DF058.o ld: 5 duplicate symbols for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I tried to remove one of the linked library Unity Ads but still get the same error, any ideas?

Phil Dukhov
  • 67,741
  • 15
  • 184
  • 220
Clive Smith
  • 51
  • 1
  • 1
  • 6

10 Answers10

12

I found a workaround.

Open the Xcode project select the UnityAdsUnityWrapper.mm in the UnityAds folder Then uncheck the Target membership Unity-Iphone

Seems to work now.

enter image description here

Benoît Freslon
  • 2,021
  • 4
  • 26
  • 35
  • It's been a few months, has anyone found a more permanent solution for this? I just started running into it with 2.17.4.1f1 after importing the Unity-Ads asset package v. 2.0. – Dihedral Jun 06 '18 at 19:56
  • this allowed the project to build but then I had no ads in the game – CthulhuJon May 11 '20 at 08:00
1

I had the same issue with a different but still newer Unity release. I upgraded to the latest today and still had the problem. There's a free Unity store package called 'Package Uninstaller' - grab that and use it to search for 'Ads'. Once you do, it exposes where the Unity Ads original and 2.0 are located if they are still in your package. As ikoukas says, you need to delete the Unity Ads files. I deleted ALL of them. Then, my build worked and the errors were gone.

1

Actually that means there is 2 UnityAds library added in the Unity Project.

Don't add the lib from the Asset Store. Just open the Services panel and activate UnityAds.

Benoît Freslon
  • 2,021
  • 4
  • 26
  • 35
1

Alright, Here is the answer everyone has been waiting for. The question remains,

"Why is unity ads creating a duplicate symbols for arm64/arm7?"

After 3 years, I ran into this problem with a "hair ripping out" experience. It wasn't nice.. But what I did to solve this issue was to disable "built-in Ads extension" in Unity Ads Services.

But before you go a head and do that, you gotta understand why it worked for me! When you enable unity built-in ad extension, Unity sort of installs a plugin that handles all the ads for you. Most people then go ahead and install another plugin from the asset store, which then creates files that collide with each other, and Xcode is therefore screwed and doesn't know what to do.. That being said, if you wanna use an Ad plugin from the asset store, make sure "built-in Ads extension" (in unity ad services) is disabled, but if you just wanna use the built-in ads extension in the unity ad services, you need to make sure every plugin that you got from the asset store that handles ads is uninstalled!

The Judge
  • 11
  • 1
1
  1. Select "Window/Package Manager"
  2. Find in tab "In Project" module "Ads"
  3. Remove "Ads" module
  4. Go to Assets store
  5. Reimport "Unity Monetization X.X"
0

I have had this issue before, but I know how to solve it.

When I imported unity ads for my own project, I somehow got two of the same files downloaded, which messed things up. In your error message, it says

Phone.build/Objects-normal/armv7/UnityAdsUnityWrapper-498FCC2E7A8DF058.o ld: 5 duplicate symbols for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Note the line "duplicate symbols". This means you have an extra file of the architecture. Try deleting one of the two duplicates. Anyway, good luck!

WilkyRL
  • 35
  • 1
  • 11
0

I found a workaround.

Open the Xcode project select the UnityAdsUnityWrapper.mm in the UnityAds folder Then uncheck the Target membership Unity-Iphone

Ratana Ly
  • 1
  • 2
0

I had this problem when trying to replace the Package Manager version with an Asset Store version (for some reason the Asset Store had a newer version).

I just had to unmark the Enable built-in Ad extension in the Ads settings in Unity:

enter image description here

Then I also had to initialize the plugin myself calling Advertisement.Initialize(gameId) where gameId is not the Unity Project Id

Roberto
  • 11,557
  • 16
  • 54
  • 68
0

That because the old Advertisement package is no longer support by Unity for iOS > 14

Just open Windows->Packages Manager->Remove the "Advertisement" package

Then install the new Advertisement package following this tutorial: https://docs.unity.com/ads/en/manual/InstallingTheiOS14SupportPackage

ImYuta
  • 41
  • 6
  • Whilst this may theoretically answer the question, [it would be preferable](//meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. Please [edit] the answer with all relevant information. Make sure to use your own words, [answers comprised entirely of a quote (sourced or not) will often be deleted since they do not contain any original content.](/help/referencing). – Adriaan Feb 10 '23 at 09:58
-2

I had the same problem. It seems I had a library of UnityAdsUnityWrapper.mm +.h in my "Plugins/iOS" directory. Try searching 'UnityAds' in your project and remove related library files.

  • What do you mean by saying "related library files"? As you stated i've the same header and .m file in that directory, i've also "UnityAds.framework" and "UnityAds.bundle" in this director. However, i couldn't understand "related library files", in the "UnityAds.framework" there are "ApplifierImpact.h" and "UnityAds.h", nothing else. – Dilara Albayrak Jul 20 '16 at 06:44
  • Sorry for the late response, I meant in your Unity project, you should remove the local files related to the UnityAds. You must rebuild the project in Unity and later try in xCode – ikoukas Dec 15 '16 at 04:25