Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Could not get GOOGLE_APP_ID in Google Services file from build environment" error

I am using the below guide to set up a dev and prod environment for my project that uses flutter + firebase https://www.tengio.com/blog/multiple-firebase-environments-with-flutter/

I have set up my respective GoogleService-Info.plist under Firebase->dev and Firebase->prod folders

I have also added below script under my Xcode Target->Build Phases (before the compile sources)

if [ "${CONFIGURATION}" == "Debug-prod" ] || [ "${CONFIGURATION}" == "Release-prod" ] || [ "${CONFIGURATION}" == "Release" ]; then
cp -r "${PROJECT_DIR}/Runner/Firebase/prod/GoogleService-Info.plist" "${PROJECT_DIR}/GoogleService-Info.plist"

echo "Production plist copied"

elif [ "${CONFIGURATION}" == "Debug-dev" ] || [ "${CONFIGURATION}" == "Release-dev" ] || [ "${CONFIGURATION}" == "Debug" ]; then

cp -r "${PROJECT_DIR}/Runner/Firebase/dev/GoogleService-Info.plist" "${PROJECT_DIR}/GoogleService-Info.plist"

echo "Development plist copied"
fi

I have tried:

flutter run --flavor dev

after

  • Flutter clean and then running
  • I went to Xcode Product -> Clean Build folder and then running
  • I have also tried to delete the iOS -> Pods folder along with Podfile.lock and then running

I get this error:

    error: Could not get GOOGLE_APP_ID in Google Services file from build environment

Any help to resolve is deeply appreciated

(Note: I have tried other stackoverflow solutions - still no luck)

like image 381
Vinayakaram Nagarajan Avatar asked Aug 23 '19 05:08

Vinayakaram Nagarajan


1 Answers

Figured out the issue finally. (Due to my Xcode ignorance) I did not know the files are to be manually "added" to Xcode. A file present in physical directory does not mean it is on Xcode

Solution: Add GoogleService-Info.plist from Runner/ onto Xcode(10.3 as of this post) by File -> Add files to "Runner.."

Note: Uncheck 'Copy if required'

like image 100
Vinayakaram Nagarajan Avatar answered Nov 14 '22 23:11

Vinayakaram Nagarajan