Skip to content

Firebase initialization failed in flutter #1447

Closed
@amitverma-cf

Description

@amitverma-cf

I don't know what is happening?

I m new to this field, kindly help me


>>flutter run --verbose

[  +56 ms] executing: [F:\MyFolder\flutter\] git log -n 1 --pretty=format:%H
[ +122 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[   +4 ms] 2d2a1ffec95cc70a3218872a2cd3f8de4933c42f
[        ] executing: [F:\MyFolder\flutter\] git describe --match v*.*.* --first-parent --long --tags
[  +67 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[        ] v1.9.1+hotfix.2-0-g2d2a1ffec
[  +17 ms] executing: [F:\MyFolder\flutter\] git rev-parse --abbrev-ref --symbolic @{u}
[ +122 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[   +1 ms] origin/stable
[        ] executing: [F:\MyFolder\flutter\] git ls-remote --get-url origin
[  +59 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +159 ms] executing: [F:\MyFolder\flutter\] git rev-parse --abbrev-ref HEAD
[  +85 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[ +247 ms] executing: F:\MyFolder\Android-SDK\platform-tools\adb.exe devices -l
[  +47 ms] Exit code 0 from: F:\MyFolder\Android-SDK\platform-tools\adb.exe devices -l
[   +1 ms] List of devices attached
           5ff595e1f484           device product:rolex model:Redmi_4A device:rolex transport_id:5
[  +31 ms] F:\MyFolder\Android-SDK\platform-tools\adb.exe -s 5ff595e1f484 shell getprop
[ +257 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[  +10 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[  +61 ms] Found plugin cloud_firestore at F:\MyFolder\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.12.10\
[  +26 ms] Found plugin firebase_analytics at F:\MyFolder\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_analytics-5.0.2\
[   +6 ms] Found plugin firebase_auth at F:\MyFolder\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.14.0+9\
[   +6 ms] Found plugin firebase_core at F:\MyFolder\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.4.0+9\
[ +160 ms] Found plugin cloud_firestore at F:\MyFolder\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.12.10\
[  +18 ms] Found plugin firebase_analytics at F:\MyFolder\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_analytics-5.0.2\
[   +9 ms] Found plugin firebase_auth at F:\MyFolder\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.14.0+9\
[  +13 ms] Found plugin firebase_core at F:\MyFolder\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.4.0+9\
[ +114 ms] ro.hardware = qcom
[ +349 ms] Launching lib\main.dart on Redmi 4A in debug mode...
[  +32 ms] Initializing gradle...
[   +6 ms] Using gradle from F:\android\flutter_apps\chatippi\android\gradlew.bat.
[   +7 ms] executing: F:\android\flutter_apps\chatippi\android\gradlew.bat -v
[+2354 ms]
                    ------------------------------------------------------------
                    Gradle 4.10.2
                    ------------------------------------------------------------

                    Build time:   2018-09-19 18:10:15 UTC
                    Revision:     b4d8d5d170bb4ba516e88d7fe5647e2323d791dd

                    Kotlin DSL:   1.0-rc-6
                    Kotlin:       1.2.61
                    Groovy:       2.4.15
                    Ant:          Apache Ant(TM) version 1.9.11 compiled on March 23 2018
                    JVM:          10.0.2 ("Oracle Corporation" 10.0.2+13)
                    OS:           Windows 10 10.0 amd64


                    WARNING: An illegal reflective access operation has occurred
                    WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass
                    (file:/C:/Users/Amit%20Verma/.gradle/wrapper/dists/gradle-4.10.2-all/9fahxiiecdb76a5g3aw9oi8rv/gradle-4.10.2/lib/groovy-all-2.4.15.jar) to method
                    java.lang.Object.finalize()
                    WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
                    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
                    WARNING: All illegal access operations will be denied in a future release
[  +36 ms] Initializing gradle... (completed in 2.4s)
[   +2 ms] Resolving dependencies...
[   +3 ms] executing: [F:\android\flutter_apps\chatippi\android\] F:\android\flutter_apps\chatippi\android\gradlew.bat app:properties
[+6457 ms]
                    FAILURE: Build failed with an exception.

                    * Where:
                    Build file 'F:\android\flutter_apps\chatippi\android\app\build.gradle' line: 24

                    * What went wrong:
                    A problem occurred evaluating project ':app'.
                    > ASCII

                    * Try:
                    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

                    * Get more help at https://help.gradle.org

                    BUILD FAILED in 5s
[  +13 ms] Resolving dependencies... (completed in 6.5s)
[   +6 ms] * Error running Gradle:
           ProcessException: Process "F:\android\flutter_apps\chatippi\android\gradlew.bat" exited abnormally:

           FAILURE: Build failed with an exception.

           * Where:
           Build file 'F:\android\flutter_apps\chatippi\android\app\build.gradle' line: 24

           * What went wrong:
           A problem occurred evaluating project ':app'.
           > ASCII

           * Try:
           Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

           * Get more help at https://help.gradle.org

           BUILD FAILED in 5s
             Command: F:\android\flutter_apps\chatippi\android\gradlew.bat app:properties

[  +12 ms] "flutter run" took 10,399ms.
Please review your Gradle project setup in the android/ folder.

#0      throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1      _readGradleProject (package:flutter_tools/src/android/gradle.dart:233:7)
<asynchronous suspension>
#2      _gradleAppProject (package:flutter_tools/src/android/gradle.dart:112:37)
<asynchronous suspension>
#3      getGradleAppOut (package:flutter_tools/src/android/gradle.dart:106:29)
<asynchronous suspension>
#4      AndroidApk.fromAndroidProject (package:flutter_tools/src/application_package.dart:164:23)
<asynchronous suspension>
#5      ApplicationPackageFactory.getPackageForPlatform (package:flutter_tools/src/application_package.dart:46:32)
<asynchronous suspension>
#6      FlutterDevice.runHot (package:flutter_tools/src/resident_runner.dart:359:56)
<asynchronous suspension>
#7      HotRunner.run (package:flutter_tools/src/run_hot.dart:254:39)
<asynchronous suspension>
#8      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:472:37)
<asynchronous suspension>
#9      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:490:18)
#10     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#11     _rootRunUnary (dart:async/zone.dart:1132:38)
#12     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#13     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#14     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#15     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#16     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#17     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15)
#18     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:288:13)
#19     RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)
#20     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#21     _rootRunUnary (dart:async/zone.dart:1132:38)
#22     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#23     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#24     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#25     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#26     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#27     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15)
#28     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:288:13)
#29     AndroidDevice.isLocalEmulator (package:flutter_tools/src/android/android_device.dart)
#30     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#31     _rootRunUnary (dart:async/zone.dart:1132:38)
#32     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#33     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#34     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#35     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#36     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#37     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:552:7)
#38     _rootRun (dart:async/zone.dart:1124:13)
#39     _CustomZone.run (dart:async/zone.dart:1021:19)
#40     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#41     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#42     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#43     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#44     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
#45     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)


In Pubspec.yaml

dependencies:
  flutter:
    sdk: flutter

  firebase_analytics: ^5.0.2

  firebase_auth: ^0.14.0+5
  cloud_firestore: ^0.12.9+5


In - android/app/build.gradle

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.chatippi"
        multiDexEnabled true
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:'1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.firebase:firebase-analytics:17.2.0'
}

apply plugin: 'com.google.gms.google-services'



In - android/build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.3.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions