close

[Solved] TypeError: Cannot read properties of undefined (reading ‘app’)

Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to use Flutter Web with Firebase SDK But I am facing following error TypeError: Cannot read properties of undefined (reading ‘app’) in Flutter. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How TypeError: Cannot read properties of undefined (reading ‘app’) Error Occurs ?

I am trying to use Flutter Web with Firebase SDK But I am facing following error.

TypeError: Cannot read properties of undefined (reading 'app')

How To Solve TypeError: Cannot read properties of undefined (reading ‘app’) Error ?

  1. How To Solve TypeError: Cannot read properties of undefined (reading 'app') Error ?

    To Solve TypeError: Cannot read properties of undefined (reading 'app') Error There is some issue with Firebase 9 So That Just try to use Firebase 8 version and now your error should be solved.

  2. TypeError: Cannot read properties of undefined (reading 'app')

    To Solve TypeError: Cannot read properties of undefined (reading 'app') Error You Need To use This Script: <script src=”https://www.gstatic.com/firebasejs/8.6.1/firebase-app.js”></script> Instead Of This Script: <script src=”https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js”></script> Now, Your error solved.

Solution 1: Replace this script

You Need To use This Script

<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-app.js"></script>

Instead Of This Script.

<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js"></script>

Now, Your error solved.

Solution 2: Add This Script in Index.html

Add This All Script In Your Index.html file.

<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-firestore.js"></script>
  <script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-storage.js"></script>

  <script>
    // Import the functions you need from the SDKs you need

    // TODO: Add SDKs for Firebase products that you want to use
    // https://firebase.google.com/docs/web/setup#available-libraries

    // Your web app's Firebase configuration
    const firebaseConfig = {
      apiKey: "...",
      authDomain: "...",
      projectId: "...",
      storageBucket: "...",
      messagingSenderId: "...",
      appId: "..."
    };

    // Initialize Firebase
    firebase.initializeApp(firebaseConfig);
  </script>

Now, Your error must be solved.

Solution 3: Use Firebase 8.x

There is some issue with Firebase 9 So That Just try to use Firebase 8 version and now your error should be solved.

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment