Could Not Get GOOGLE_APP_ID In Google Services File From Build Environment


Answer :

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



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}"


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



Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable