SeaFuzz
SeaFuzz

Reputation: 1237

Firebase Assistant Fails to Launch (Flutter)

I can't seem to get Firebase Assistant working in Android Studio and get the following error.

Exception

null
java.util.NoSuchElementException at com.google.common.collect.Iterators$1.next(Iterators.java:81) at com.google.services.firebase.DependencyStateManager.getDependencyState(DependencyStateManager.java:60) at com.google.services.firebase.DependencyStateManager.init(DependencyStateManager.java:109) at com.android.tools.idea.assistant.view.StatefulButton.(StatefulButton.java:122) at com.android.tools.idea.assistant.view.TutorialStep.(TutorialStep.java:106) at com.android.tools.idea.assistant.view.TutorialCard.redraw(TutorialCard.java:153) at com.android.tools.idea.assistant.view.TutorialCard.(TutorialCard.java:90) at com.android.tools.idea.assistant.view.FeaturesPanel.(FeaturesPanel.java:84) at com.android.tools.idea.assistant.AssistSidePanel.(AssistSidePanel.java:81) at com.android.tools.idea.assistant.AssistToolWindowFactory.createToolWindowContent(AssistToolWindowFactory.java:37) at com.android.tools.idea.assistant.OpenAssistSidePanelAction.lambda$openWindow$0(OpenAssistSidePanelAction.java:59) at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:424) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:407) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762) at java.awt.EventQueue.access$500(EventQueue.java:98) at java.awt.EventQueue$3.run(EventQueue.java:715) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:732) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:822) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:650) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:366) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

I've installed all the plugins and SDK Tools required including:
Google Repository Firebase App Indexing Firebase Services Firebase Testing

My configurations are as follows.

enter image description here

build.gradle

buildscript {
    ext.kotlin_version = '1.2.31'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:3.2.0' // google-services plugin
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

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

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

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.")
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
    compileSdkVersion 27

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.networks.hn"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        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 {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'com.google.firebase:firebase-core:12.0.1'
    compile 'com.google.firebase:firebase-core:12.0.1'
    compile 'com.google.firebase:firebase-storage:12.0.1'
    compile 'com.google.firebase:firebase-auth:12.0.1'
    compile 'com.google.firebase:firebase-messaging:12.0.1'
    compile 'com.google.firebase:firebase-database:12.0.1'
}

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

pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  intl: "^0.15.2"
  flutter_localizations:
    sdk: flutter
  redux: "^2.1.1"
  flutter_redux: "^0.3.5"
  transparent_image: "^0.1.0"

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.0
  # Cloudstore Firebase
  cloud_firestore: ^0.3.2

When I try integrating anything firebase in the application I get a series of compile errors which go away when I remove that code. I suspect I have something misconfigured or there is a version conflict somewhere.

I am running Android Studio 3.1

Upvotes: 3

Views: 1650

Answers (3)

ANORAK_MATFLY
ANORAK_MATFLY

Reputation: 385

For a flutter project. First, delete your Firebase app on project settings then click on remove this app, after that go to the route of your project and paste these commands.

Command 1: dart pub global activate flutterfire_cli.

Command 2: flutterfire configure --project=YOUR PROJECT NAME

Upvotes: 0

Scott Tomaszewski
Scott Tomaszewski

Reputation: 1019

I also ran into this issue and resolved it by updating everything:

  • Android studio 3.1 -> 3.2
  • All the SDK Tools that I already installed (Tools > SDK Manager > SDK Tools)
  • The Flutter and Dart plugins (Preferences > Plugins)

I also tried Justin's answer of uninstalling the Firebase plugins, restarting, then reinstalling.

After everything, restart Android Studio and let the IDE finish all of its indexing and other tasks, then open Firebase assistant (Tools > Firebase)

Upvotes: 0

Justin Ricci
Justin Ricci

Reputation: 1

I had the same problem. I went to Settings > Plugins and then removed all 3 firebase plugins. Restarted. Back to Plugins, add all 3 firebase plugins. Restart. Then it worked fine!

Upvotes: 0

Related Questions