[iOS] duplicate symbols: libGoogleAnalytics.a and libGoogleAnalytics_debug.a Cannot Coexist

Tadashi Shigeoka ·  Mon, April 29, 2013

When I tried to build an Xcode iOS project, I encountered the following error:

duplicate symbol _OBJC_METACLASS_$_GAIDispatcher in:
    /Users/your_username/git/MyApp/Externals/GoogleAnalytics/libGoogleAnalytics_debug.a(GAIDispatcher.o)
    /Users/your_username/git/MyApp/Externals/GoogleAnalytics/libGoogleAnalytics.a(GAIDispatcher.o)
ld: 212 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

■ Solution

In [TARGETS] → [Build Phases] → [Link Binary With Libraries], remove the link to either libGoogleAnalytics_debug.a or libGoogleAnalytics.a.

As the filename suggests, libGoogleAnalytics_debug.a is a library for debugging, so the error occurred because I was trying to coexist it with the production library libGoogleAnalytics.a.

Reference Information

That’s all from the Gemba.