"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)
Answer
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'
Related Questions
- → How can I query Firebase for an equalTo boolean parameter?
- → How can I access nested data in Firebase with React?
- → Firebase simple blog (confused with security rules)
- → Removing item in Firebase with React, re-render returns item undefined
- → AngularJS Unknown Provider Error (Firebase & AngularFire)
- → How do you pass top level component state down to Routes using react-router?
- → "this" is null in firebase query function in reactjs
- → Angular Module Failed to Load
- → Multiple dex files define Lcom/google/android/gms/internal/zzrx;
- → Joining Firebase tables in React
- → How can I make add firepad to my reactjs project?
- → How to use Cloud Functions for Firebase to prerender pages for SEO?
- → React.js component has null state?