Vinayakaram Nagarajan
Vinayakaram Nagarajan

Reputation: 825

"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

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)

Upvotes: 11

Views: 14680

Answers (1)

Vinayakaram Nagarajan
Vinayakaram Nagarajan

Reputation: 825

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'

Upvotes: 23

Related Questions