react-native-maps: 0.21.0 iOS build failed when Google Maps are not included
Is this a bug report?
Yes
Have you read the Installation Instructions?
Yes
Environment
react: 16.3.0 react-native: 0.54.4 react-native-maps: 0.21.0 iOS only, without Google Maps
Steps to Reproduce
Expected Behavior
The build succeeds.
Actual Behavior
The iOS build crashes with AIRGoogleMapCircle.h:7:9: fatal error: 'GoogleMaps/GoogleMaps.h' file not found even if I do not use Google Maps.
The cause is commit https://github.com/react-community/react-native-maps/commit/d22f96f9115f10b50085206463143c421f8d948d where some Google-depending sources have been added to AirMaps.xcodeproj/project.pbxproj.
For now I got things moving again with a npm postinstall script that deletes the references:
"postinstall": "sed -i '' '/Google.*\\.[h|m]/d' node_modules/react-native-maps/lib/ios/AirMaps.xcodeproj/project.pbxproj"
Reproducible Demo
I expect that any iOS project that does not use Google Maps will have the same problem.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 32
- Comments: 46 (4 by maintainers)
I ran into the same issue using:
without having the GoogleMaps headers configured for iOS. Fixed by applying the
.patchfile below toreact-native-mapstagv0.21.0during postinstall. I’m not using Pod yet.https://gist.github.com/meylor/442cf17ae6ff6213b358866dde4f5b77 To use the patch, copy the file above to
node_modules/react-native-mapsand runpatch -p1 < react-native-maps-remove-google-support.patchThe sed command didn’t fix the issue for me.
Is there any installation instructions for people who do not use cocoapods? Cann’t get the new version work in ios because of the GoogleMap.h not fount error.
Or, does anyone who managed to work by manually installing GoogleMap SDK?
I just upgraded from 0.20.1 to 0.21.0 and am also having problems.
Environment react: ^16.3.0-alpha.1 react-native: 0.54.4 react-native-maps: 0.21.0 iOS, without Google Maps
Screenshot
We managed to get it installed without CocoaPods!
cc: @theonetheycallneo maybe we could share what we did with this thread to help others looking to do a pure manual install.
nothing has worked for me so far 😦
@rborn @rafaellincoln I can try to take a look at making a PR this weekend. I don’t think that removing the AirGoogleMaps dependencies from
project.pbxprojis the right approach since someone may actually want to use GoogleMaps on iOS. I’m guessing that most people are having an issue because they’re not using CocoaPods, which is a requirement in the installation instructions.Simple solution should be to add instructions for manually adding the GoogleMaps header files. I haven’t yet looked at the source, but it seems odd that the default behavior for not using GoogleMaps is to not have the Pod dependencies, which are a requirement in the
project.pbxprojfile.@billtlee @radubatori suggested a workaround himself.
I automated it (for CI etc.) by having this in the
package.json:and of course
npm install -S cross-osIt basically removes all references to Google Maps in the faulty
AirMaps.xcodeproj/project.pbxproj@TheWrongAlice If running
sed -i '' '/Google.*\\.[h|m]/d' node_modules/react-native-maps/lib/ios/AirMaps.xcodeproj/project.pbxproj(macos) will fix your problem, then it’s probably the same issue.#2396 was merged, please test with the latest git version. Please keep in mind that you might have to setup the module again as now it works with
react-native linkRead the install manual carefullyThis issue looks like a duplicate of https://github.com/react-community/react-native-maps/issues/2270.
I opened a PR at https://github.com/react-community/react-native-maps/pull/2310 which coincidentally appears to implement the same patch that @meylor came up with, please test it to see if it fixes this issue for y’all!
@radubatori The gradle 4 issue you mentioned sounds like it could be https://github.com/facebook/react-native/issues/16906
Hey guys, I’ve posted a public gist for all:
https://gist.github.com/theonetheycallneo/bea215ebfbc7d7ade422458f60760df1
@meylor I got some type of error running that patch. Now I got 33 new build errors. Did I use it wrong?
@hlbp I do still get the “unexpectedly ends in middle of line” but it seems harmless as I am still able to build my application in Xcode. I think I just needed to do a Clean and delete my build folder (
rm -rf ios/build) and then it worked 😃I’ve reopened the issue, but I cannot provide a clean environment to reproduce it.
@arichnad The extra backslash is there to escape the backslash in
package.json. If the command is ran directly, then yes, one backslash has to be removed.Can you reopen this ticket? I’m also having this problem. The sed line that @radubatori suggests does fix this problem for me. (@radubatori you should remove one of the backslashes in your sed line)
@nolan12345 it doesn’t work. Solution by @dj-hedgehog is awsome! 👍
Add pod ‘GoogleMaps’, ‘~> 2.7.0’ and then pod install solves the problem
@theonetheycallneo Hi! I tried your instruction, but maybe something missed.
What I am doing.
question: what means the line
$(SRCROOT)/Frameworks/Google-Maps-iOS-Utilsin this step?Frameworksand it containslibReact.a, so I addedGoogleMaps.framework,GoogleMapsCore.frameworkandGoogleMapsBase.frameworkfrom unzipped ios sdk folder.Drag this three frameworks to
Embedded Binariesnotice: I noticed, that after that, there were no changes in
Build Phases/Compile Sources, it contains onlymain.mandAppDelegate.m.question: What it means? I don
t have a folderGoogle-Maps-iOS-Utilsin xcodeFrameworks`.Frameworksfolder in xcode. You could see it in left sidebar in above screenshot.notice: In Build Phases/Compile Sources` there are a lot of files after step 4.
But I got an error:
I research a problem and found that this is a dependency from https://github.com/googlemaps/google-maps-ios-utils but I don`t have it. How I could install it?
@TheWrongAlice what were you doing wrong? i have the same problem like you. im getting
@meylor I got your solution to work now (I guess I was doing something wrong the first time). My build is succeeding! 🎈 I hope that this can be fixed in the master branch soon.
@dj-hedgehog worked ! thx !
@duro would love to see manual install instructions sans cocoa pods cc @theonetheycallneo
I would love to see some installation instructions that do not require CocoaPods. No matter how complicated they may be.
@hamsddxn this solution means it needs to be done every time yarn install re-installs libraries and it will not work for CI-s.
I use cocoa-pods in my projects but I prefer to keep react-native out of it so far, as there are other libraries that depend on react and don’t support cocoapods (react-native-navigation is one of them).
@TheWrongAlice here are the versions from my
package.jsonpostinstall.sh is is just doing
patch -p1 < $patchfile; perhaps you’re not having the same issue?@rafaellincoln could you please have a look? 🤗
I did not use Google Maps from the start, so the podfile does not reference ‘react-native-google-maps’ or ‘GoogleMaps’. The same result is obtained if I do not use pods and add AirMaps as a library directly.