Error "library not found for" after putting application in AdMob

400,501

Solution 1

Sometimes you just remove the reference of the library and add reference again.

Apart from adding the Google Mobile Ads SDK and other libraries again from scratch, I would recommend you checking the Library Search Paths. There are instances when you copy or duplicate a target, Xcode decides that it needs to escape any double quotes " with a '\'. Make sure you remove all the \’s - it should look like this -

enter image description here

I was able to duplicate the error, by doing prefixing my path with multiple '\'.

Solution 2

I had a similar "library not found" issue. However it was because I accidentally was using the .xcodeproj file instead of the .xcworkspace file.

Solution 3

Select your Target, go to "Build Phases" in "Link Binary With Libraries" remove ".a" file of that library. Clean and Build.

Solution 4

If error related to Cocoapods as follow:

library not found for -lPod-...

You need to check Other Linker Flags and remove it from there.

Extra Information: If you have an old project that uses cocoapods. And recently you needed to add the use_frameworks! to your podfile. cocoapods will not add the libraries to your Other Linker Flags anymore cause its inherited. Therefore, you may need to remove those manually from the other linker flags which they were added before using the use_frameworks!

Solution 5

For my case Xcode 7, also worked in Xcode 9.1/9.2

ld: library not found for -ldAfnetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)

set Build Active architecture Only to Yes

enter image description here

Share:
400,501

Related videos on Youtube

ViniciusPV
Author by

ViniciusPV

Updated on February 15, 2022

Comments

  • ViniciusPV
    ViniciusPV over 2 years

    I am getting an error after I put my application in an AdMob. The app was working until today. The error is the following:

    ld: library not found for -lGoogleAdMobAds
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    How can I fix this? Thank you.

  • Mayur Deshmukh
    Mayur Deshmukh over 8 years
    I have many flags here, should I remove all or just the one for the Pod?
  • hasan
    hasan over 8 years
    If those flags causes a problem. you should remove them or keep them and add the library if you still want to use it.
  • Jabbar
    Jabbar almost 8 years
    What about when we need to create a Production build for App Store? I mean it should be NO for Production Build.
  • Ted
    Ted almost 8 years
    agree it should be NO for production
  • Jabbar
    Jabbar almost 8 years
    Will this NO effect on Production Build Installation?
  • Eduardo Oliveros
    Eduardo Oliveros almost 8 years
    i remove that but doesn't work, mix panel its the problem
  • hasan
    hasan over 7 years
    I guess that happens when you try to remove the library that is added by cocoa pods manually. The correct way is to remove the library from your podfile. then you run pod install again
  • Eva Madrazo
    Eva Madrazo over 7 years
    Thanks!! This was a clue for me :). In my case, the duplicate target has divided every -l"framework" in two lines "-l" and "framework" !!
  • brainray
    brainray about 7 years
    Yup, strange enough that Xcode doesn't mark it missing by coloring it red
  • Romain TAILLANDIER
    Romain TAILLANDIER about 7 years
    you also could have rename the target in the podfile.
  • Aakash Aggarwal
    Aakash Aggarwal over 6 years
    Worked for me while integrating Pinterest SDK on XCode 9.2 and iOS 11.
  • edenwaith
    edenwaith over 6 years
    This fixed my particular problem. I had two similar named libraries, one named libPods-Foo BarTests.a and another one named libPods-FooBarTests.a .
  • InnisBrendan
    InnisBrendan over 6 years
    I found references to AWS pods I just removed from my project here. Thanks
  • Prince Kumar Sharma
    Prince Kumar Sharma about 6 years
    good one, after pod install, one of the library was not listed there. I don't know why but adding that library path makes it work.
  • Ian Steffy
    Ian Steffy about 6 years
    @EvaMadrazo This happened with me too. Did you delete all but one "framework" or just combine them into one line?
  • Eva Madrazo
    Eva Madrazo about 6 years
    @IanSteffy just combine it
  • EFreak
    EFreak almost 6 years
    Can somebody please explain the purpose of .xcodeproj and .xcworkspace?
  • Mark
    Mark almost 6 years
    Things like this make me love the Javascript ecosystem
  • Jose Pose S
    Jose Pose S almost 6 years
    Really nice!! my problem was when I added user framework to old project. Remove coreplot.a and works fine!!!!
  • Brayan Loayza
    Brayan Loayza almost 6 years
    How i can change that..?
  • Azam
    Azam over 5 years
    xcworkspace is when you use Cocoapods. It's not Xcode problem, but the users.
  • ZedTuX
    ZedTuX about 5 years
    Well this fixed my issue "Library not found for -lART" and it's really unbelievable ! Thank you !
  • Will
    Will almost 5 years
    ffs I wasted a good 5 hours earlier this afternoon because I didn't realize the difference. -_-
  • Luat Vu Dinh
    Luat Vu Dinh almost 5 years
    Consider "Header Search Paths" too.
  • Daniel Benedykt
    Daniel Benedykt over 4 years
    .xcworkspace is when you have more than 1 "project" inside your solution. For example you can have external libraries (cocoapods) or your own library that you use in many projects.
  • Flacito
    Flacito over 4 years
    This gets me about once every 6 months with XCode. It's especially a problem with react-native and other similar Pods heavy apps. You need the workspace not the project.
  • MathMax
    MathMax about 4 years
    @raurora How do you access library search paths?
  • raurora
    raurora about 4 years
    @MassimoFrittelli Project > Build Settings tabs > Search Paths. You can type on the search option too.
  • Nathanael
    Nathanael almost 3 years
    This is what I needed - Thank you!
  • Papyrus
    Papyrus over 2 years
    This happened to me when I updated a pod project to XCode 13 relating to the Nimble framework that the previous version Cocoapod tool (used to create the workspace) stuck into the Podfile at a specific version. This made pod update not fix it right away, I had to replace pod 'Nimble', '~> X.Y.Z' with just pod 'Nimble' which updated Nimble to the latest version which solved my problem.