react-native-maps: duplicate symbols for architecture x86_64

After dragging the AirMaps and AirGoogleMaps folders into my xcode project and running react-native run-ios, I get

ld: 175 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **

Full output here: http://pastebin.com/td7gRy9g

Anyone else have this issue or just me?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 58
  • Comments: 52 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I resolved this issue and succesfully implemented GMaps on IOS simulator by the followings: (ref.: http://stackoverflow.com/questions/24298144/duplicate-symbols-for-architecture-x86-64)

  1. Open Xcode > Pods > Targets Support Files > Pods-{TARGET-NAME} find “OTHER_LDFLAGS” and remove only “-ObjC” in these two files: Pods-{TARGET-NAME}.release.xcconfig & Pods-{TARGET-NAME}.debug.xcconfig
  2. Go to project main target > Build Settings > Other Linker Flags: Make sure no “-ObjC” is left in the value
  3. I deleted the build/Build folder in ios and run-ios again. It works now.
  4. Also make sure you have enable Google Maps SDK for iOS on Google APIs console (only enabling API key will not success)

Side effects from the link above: the app may become larger as there may be duplicated symbols during compile

Hope can help you. P.S. Not yet try on real device

Just chiming in, I finally got around the duplicate symbols problem on all build configs (Debug/Release/Archive) with the following steps:

Versions:

  • react-native v42
  • react-native-maps v0.14.0

If you have an existing project, clear out any modifications to your Podfile that you’ve made while following the install instructions/GH issue comments Remove any and all AirMaps and/or AirGoogleMaps Libraries/References from your XCode Project / Workspace Make sure the default React xcodeprojects are listed under your XCode Libraries, as they won’t be added to the Podfile (see screenshot 1 below).

Install and link the regular react-native-maps module without using Pods!

npm install --save react-native-maps react-native-link react-native-maps

At this point you should have the AirMaps.xcodeproj under your Libraries folder in XCode (screenshot 1), and libAirMaps.a and the default React libs are in your Linked Frameworks and Libraries (screenshot 2)

Screenshot 1

Screenshot 2

Now the fun stuff

Drag the AirGoogleMaps folder from node_modules/react-native-maps/lib/ios into the top most level of your Xcode Project, and select add as ‘Create Groups’ when the popup appears after dropping the folder.

AirGoogleMaps needs the React headers, so add $(SRCROOT)/../node_modules/react-native/React to your Header Search Paths (under Build Settings in Xcode) and make it recursive. Double check the AirMaps path is in there as well (Screenshot 3)

Screenshot 3

Now AirGoogleMaps should be completely linked, the GoogleMaps pod just needs to be installed.

Go to the Podfile, and add pod 'GoogleMaps', and run pod install (Screenshot 4)

Screenshot 4

Now run Run/Build/Archive, and it should all compile without duplicate symbols!

Successfully tested on a real iOS device with a Google Map and custom styles (just to really confirm it was a GMap rendering).

Please let me know if this works for anyone else, if it fixes the problem for everyone then I’ll make a PR to update the install documentation

Try to add code at the very end of Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end

@hafizmuhammadshoaib react-native unlink react-native-maps; cd ios; pod install;

Look at your Podfile, take a note of all the modules declared in there and remove those exact modules in Xcode under Libraries. This helped for react-native: 0.41.2.

I have resolved it, this is my pod file below


# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

target 'App' do
  # Uncomment this line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for NearBy


  pod 'React', path: '../node_modules/react-native', :subspecs => [
  'Core',
  'RCTActionSheet',
  'RCTGeolocation',
  'RCTImage',
  'RCTLinkingIOS',
  'RCTNetwork',
  'RCTSettings',
  'RCTText',
  'RCTVibration',
  'RCTWebSocket'
  ]

  pod 'GoogleMaps'



end
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!


  • First I made sure that react-native link goes on without an error.
  • Do the pod install with the above podfile edited with right project
  • Moved AirGoogleMaps and AirMaps to ios project by dragging.
  • Removed Airmaps.xcodeproj and libairmaps if it exist in Libraries folder and Build Settings respectively.

#713

in my case these duplicate errors were occurring because I have .m files for these objects twice in xcode. Once because “pod install” has added AirMaps.xcodeproj to my project. And another because the react-native-maps instructions told me to drag the AirMaps files into my project. (https://github.com/airbnb/react-native-maps/blob/master/docs/installation.md)

I’m not sure why the instructions tell you to copy the files over - they’re already there! I resolved it simply by not copying the AirMaps folder into my project.

Followed @se1exin guide, but getting the error message about the missing AirGoogleMaps directory 😦

i just had to remove libairmaps.a from the search of build phases 😉

@alvelig Thankyou it works like a charm

@se1exin ~It’s not working for me on 0.47.1, is that correct?~

Wuuut, I didn’t follow the cleanup step because I thought it wasn’t needed. But it clearly was, it works now. Thanks, you saved me so much time!

@arthurnn As far as I remember its in Build Phases not Build Settings under Compile Sources or Link Binary With Libraries

This issue is already alive for 3 years. “react-native-maps”: “^0.24.2”, the same problem.

Try to add code at the very end of Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end

It worked for me, very Thanks

i just had to remove libairmaps.a from the search of build phases 😉

It works for me, thanks @mor12

If anyone is still having problems I followed this walkthrough and it worked perfectly. Very easy to follow and has step by step instructions. https://medium.com/@kswanie21/react-native-google-map-with-react-native-maps-572e3d3eee14

Hey @se1exin!

Thank you so much for your instructions! Do you have to add your Gmaps api key anywhere though? I ran your steps explicitly on a new react native project and it all worked great, but now I’m scratching my head about the API key stuff 😃

Thanks again!!

I was able to fix this issue by following @hzalaz instructions on this following (https://github.com/auth0/react-native-lock/issues/3).

In summary, the duplication issue because you a linking RCT**** Libraries twice, once in your PodFile and again in your SubProjects.

I got the same error and thanks to @jojonarte this step solved my problem: Removed Airmaps.xcodeproj and libairmaps if it exist in Libraries folder and Build Settings respectively.