Could not get GOOGLE_APP_ID in Google Services file from build environment

IosSwiftFirebaseCrashlytics

Ios Problem Overview


For setting up firebase i am using two config 1.GoogleService-Info-test.plist, 2.GoogleService-Info-prdn.plist for UAT and Production. For installing crashlytics using firebase i have followed firebase documentation https://firebase.google.com/docs/crashlytics/get-started?authuser=1#ios. But when i try to run, it throws error in build phase while running script.

I tried without changing config file name and it worked.

Error msg at build phase while running fabric run script "Could not get GOOGLE_APP_ID in Google Services file from build environment".

Can anyone suggest better solution to achieve my requirement.

Ios Solutions


Solution 1 - Ios

This is one way you can do it, by having your projects environments separated by targets, by doing so you can then add your different plist files and just check the target that they belong to, that way when you compile the target it will take it's corresponding plist file

Sample Image

Another way to do it, or to look up how to do it, it's called multiple environments with firebase, here are some helpful links

https://stackoverflow.com/questions/37615405/use-different-googleservice-info-plist-for-different-build-schemes

https://medium.com/rocket-fuel/using-multiple-firebase-environments-in-ios-12b204cfa6c0

Solution 2 - Ios

This worked for me:

When install Crashlytic with Firebase, for multiple scheme, you can have error Could not get GOOGLE_APP_ID in Google Services file from build environment. You can fix it by:

  • In Build Settings, add a user define for file name in User Defined:

Add file name for each scheme in User Defined

  • In Build Phases, tap plus button, New Run Script Phase above your Crashlytic build phase, and type this code to the text field. Remember to rename %YOUR_CUSTOM_PATH_TO_FOLDER% to your path to Plist files:
GOOGLE_SERVICE_INFO_PLIST_FROM="${PROJECT_DIR}/%YOUR_CUSTOM_PATH_TO_FOLDER%/${FIREBASE_CONFIG_FILE}.plist"
BUILD_APP_DIR="${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}"
GOOGLE_SERVICE_INFO_PLIST_TO="${BUILD_APP_DIR}/GoogleService-Info.plist"
cp "${GOOGLE_SERVICE_INFO_PLIST_FROM}" "${GOOGLE_SERVICE_INFO_PLIST_TO}" 

Add build phase

Solution 3 - Ios

This worked for me:

Make sure you add the Xcode Crashlytics build phase after Copy Bundle Resources.

Solution 4 - Ios

I had this in my "Build Phases" and it's works

"${PODS_ROOT}/FirebaseCrashlytics/run"
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/MyApp/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"

Solution 5 - Ios

Our project only one target, but we need to use two Firebase config files GoogleService-Info-Prod.plist and GoogleService-Info-Dev.plist.

I had this in my "Build Phases" and it works.

if [ "${CONFIGURATION}" = "Release" ]; then
${PODS_ROOT}/FirebaseCrashlytics/run -gsp ${PROJECT_DIR}/RushCard/FirebaseConfig/GoogleService-Info-Prod.plist
else
${PODS_ROOT}/FirebaseCrashlytics/run -gsp ${PROJECT_DIR}/RushCard/FirebaseConfig/GoogleService-Info-Dev.plist
fi

Solution 6 - Ios

In my case I created New Run Script Phrase above Compile Sources, that's why I always see

> Could not get GOOGLE_APP_ID in Google Services file from build environment

When I moved Crashlytic's run script at the end of list bug was disappear. Please look the following screen shot: enter image description here

And article about it is here

Solution 7 - Ios

Another way is to make sure one plist keeps the original name GoogleService-Info.plist

Different targets meant more work to update CI for me.

This is valid for Xcode 11 at least, not tested on any other versions

Solution 8 - Ios

I use multiple configurations for several white-labelled apps. I added a User-Defined variable FIREBASE_SUFFIX and changed my script to the following:

${PODS_ROOT}/FirebaseCrashlytics/run -gsp ${PROJECT_DIR}/Firebase/GoogleService-Info-${FIREBASE_SUFFIX}.plist

NOTE: I use Carthage for firebase here: https://github.com/firebase/firebase-ios-sdk/blob/master/Carthage.md. If you're this same setup, you should use something like this instead (replace the path to where you put your script files):

${PROJECT_DIR}/scripts/run -gsp ${PROJECT_DIR}/Firebase/GoogleService-Info-${FIREBASE_SUFFIX}.plist

Solution 9 - Ios

I was using new Firebase/Crashlytics which beta and getting error "No Google App ID or Google Services file provided" when I try to upload manually dSYMS

Here is command:

/path/to/pods/directory/FirebaseCrashlytics/upload-symbols
-gsp/path/to/GoogleService-Info.plist -p ios /path/to/dSYMs

Then I reliaze there should be space between "-gsp" and path to Google.plist after that It worked.

Solution 10 - Ios

The solution for me was removing the call to upload-symbols script.

One of the Crashlytics guides mentions you should add this:

${PODS_ROOT}/FirebaseCrashlytics/run
/path/to/pods/directory/FirebaseCrashlytics/upload-symbols  <- Not needed

I misinterpreted this... the run script already calls upload-symbols so there's no need to add a second call.

Solution 11 - Ios

Make sure in Xcode file explorer (i.e on the left side) "GoogleService-Info.plist" is showing. If not you have to drag and drop "GoogleService-Info.plist" in Xcode panel.

In my case problem is I added copy-pasted file in the project location, due to this file reference is missing in the Project info.

Solution 12 - Ios

Well all above answers purpose a possible solution for this issue, in my case GoogleService.plist file was missing from 'Copy Bundle Resources' by adding into it worked in my case..

To check the file goto

Project Directory >> Build Phases >> Copy Bundle Resources

add it add here if you find missing.

Solution 13 - Ios

If these solutions provided above do not work, I solved mine by going to Build phases as shown on this image. Click on plus and add Google plist

Xcode screenshot solution

Solution 14 - Ios

I was able to fix this by locate where is my GoogleService-Info.plist, copy it to ios folder in Flutter and run with this script

"$PODS_ROOT/FirebaseCrashlytics/upload-symbols" --flutter-project "$PROJECT_DIR/firebase_app_id_file.json" -gsp "$PROJECT_DIR/GoogleService-Info.plist" -p ios "$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME"

Update: I found a better solution:

  • Just upgrade all firebase package to lastest version
  • Remove Crashlytics build script
  • Run flutter clean, flutter pub get
  • pod install (in ios folder)

Solution 15 - Ios

I had the same error, also due to the fact that I have multiple bundle identifier and therefore I have a build phase script called Firebase Script (that pinpoints to the correct GoogleService-Info.plist ) that was running after the Crashlytics script. The solution is to run Firebase Script before the Crashlytics script.

Solution 16 - Ios

In my case I had a different name in my file, his name was GoogleService-Enterprise-Info.plis when I change it to the normal name GoogleService-Info.plist, IT WORK FINE !!

Solution 17 - Ios

I faced the same issue for @react-native-firebase/crashlytics

In case you are facing this issue, you probably have missed the 'ios setup' instruction mentioned in below link. Please follow the instruction to fix the issue. https://rnfirebase.io/#generating-ios-credentials

Solution 18 - Ios

Just download from Settings of your projects and place for your correct target which you are running.

plist file

Solution 19 - Ios

This error would be shown if there is a space in your project name or in the path of your project.

Read more in this GitHub Issue

Solution 20 - Ios

Additionally to other answers..

I faced that problem with exact same error message and in my case everything was ok with file GoogleService-Info.plist except that it was genereated with wrong Bundle ID for application (it was changed in XCode much later than initial Firebase setup happened), so I had to create new app in Firebase Console with correct Bundle ID (it's not able to edit) and download new GoogleService-Info.plist

Solution 21 - Ios

If you are using one of the popular build scripts going around for handling multiple different environments, it is probably useful to know that you should use a different GoogleService-Info.plist destination based on the target platform:

// iOS
PLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app

// watchOS
PLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.appex

// macOS
PLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Resources

Solution 22 - Ios

Try downgrading, it worked for me! I used: 'Fabric', '1.9.0' 'Crashlytics', '3.12.0'

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMukesh GamiView Question on Stackoverflow
Solution 1 - IosSamuel ChavezView Answer on Stackoverflow
Solution 2 - IoshuyncView Answer on Stackoverflow
Solution 3 - Iosbizz84View Answer on Stackoverflow
Solution 4 - IosCmoiJulienView Answer on Stackoverflow
Solution 5 - IosJayView Answer on Stackoverflow
Solution 6 - IosTarasView Answer on Stackoverflow
Solution 7 - IosAaron Thai GuyView Answer on Stackoverflow
Solution 8 - IosJacobView Answer on Stackoverflow
Solution 9 - IosUcdemirView Answer on Stackoverflow
Solution 10 - IosHarout360View Answer on Stackoverflow
Solution 11 - IosVivek BansalView Answer on Stackoverflow
Solution 12 - IosZeeshan AhmedView Answer on Stackoverflow
Solution 13 - IosyendisView Answer on Stackoverflow
Solution 14 - IosKyo HuuView Answer on Stackoverflow
Solution 15 - IosGarollaView Answer on Stackoverflow
Solution 16 - IosAlex VargasView Answer on Stackoverflow
Solution 17 - IosAnupam ChaplotView Answer on Stackoverflow
Solution 18 - IosManishView Answer on Stackoverflow
Solution 19 - IosYaman KATBYView Answer on Stackoverflow
Solution 20 - IosPavel SokolovView Answer on Stackoverflow
Solution 21 - IosbudiDinoView Answer on Stackoverflow
Solution 22 - IosMauker OlimpioView Answer on Stackoverflow