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

8,547

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'

Share:
8,547
Vinayakaram Nagarajan
Author by

Vinayakaram Nagarajan

Updated on December 13, 2022

Comments

  • Vinayakaram Nagarajan
    Vinayakaram Nagarajan over 1 year

    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)

  • Quentin Klein
    Quentin Klein about 4 years
    You saved my life here. Thanks.
  • Nivrutti Pawar
    Nivrutti Pawar over 3 years
    Unfortunately not working for I have added files in the same directory