Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not get GOOGLE_APP_ID in Google Services file from build environment

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.

like image 270
Mukesh Gami Avatar asked Jul 12 '19 12:07

Mukesh Gami


4 Answers

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

Use different GoogleService-Info.plist for different build schemes

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

like image 168
Samuel Chavez Avatar answered Oct 21 '22 01:10

Samuel Chavez


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

like image 40
huync Avatar answered Oct 21 '22 02:10

huync


This worked for me:

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

like image 40
bizz84 Avatar answered Oct 21 '22 00:10

bizz84


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}"
like image 29
CmoiJulien Avatar answered Oct 21 '22 01:10

CmoiJulien