Firebase助手无法启动(颤动)

时间:2018-04-01 21:18:57

标签: android firebase flutter firebase-assistant

我似乎无法让Firebase助手在Android Studio中运行并出现以下错误。

Exception

  


  java.util.NoSuchElementException at   com.google.common.collect.Iterators $ 1.next(Iterators.java:81)at   com.google.services.firebase.DependencyStateManager.getDependencyState(DependencyStateManager.java:60)     在   com.google.services.firebase.DependencyStateManager.init(DependencyStateManager.java:109)     在   com.android.tools.idea.assistant.view.StatefulButton。(StatefulButton.java:122)     在   com.android.tools.idea.assistant.view.TutorialStep。(TutorialStep.java:106)     在   com.android.tools.idea.assistant.view.TutorialCard.redraw(TutorialCard.java:153)     在   com.android.tools.idea.assistant.view.TutorialCard。(TutorialCard.java:90)     在   com.android.tools.idea.assistant.view.FeaturesPanel。(FeaturesPanel.java:84)     在   com.android.tools.idea.assistant.AssistSidePanel。(AssistSidePanel.java:81)     在   com.android.tools.idea.assistant.AssistToolWindowFactory.createToolWindowContent(AssistToolWindowFactory.java:37)     在   com.android.tools.idea.assistant.OpenAssistSidePanelAction.lambda $ $的openWindow 0(OpenAssistSidePanelAction.java:59)     在   com.intellij.openapi.application.TransactionGuardImpl $ 2.run(TransactionGuardImpl.java:315)     在   com.intellij.openapi.application.impl.LaterInvocator $ FlushQueue.runNextEvent(LaterInvocator.java:424)     在   com.intellij.openapi.application.impl.LaterInvocator $ FlushQueue.run(LaterInvocator.java:407)     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)     在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)     在java.awt.EventQueue.dispatchEvent(EventQueue.java:732)at   com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:822)     在   com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:650)     在   com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:366)     在   java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)     在   java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)     在   java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)     在   java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)     在   java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)     在java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

我已经安装了所需的所有插件和SDK工具,包括:
Google Repository Firebase App Indexing Firebase Services Firebase Testing

我的配置如下。

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
}

应用/的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

当我尝试在应用程序中集成任何firebase时,我得到一系列编译错误,当我删除该代码时,这些错误就会消失。我怀疑我有一些配置错误或某处存在版本冲突。

我正在运行Android Studio 3.1

2 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。我去了设置>插件然后删除所有3个firebase插件。重新启动。回到插件,添加所有3个firebase插件。重新开始。然后它工作正常!

答案 1 :(得分:0)

我也遇到了这个问题,并通过更新所有内容解决了该问题:

  • Android Studio 3.1-> 3.2
  • 我已经安装的所有SDK工具(工具> SDK管理器> SDK工具)
  • Flutter和Dart插件(首选项>插件)

我还尝试了Justin的答案,即卸载Firebase插件,然后重新启动,然后重新安装。

完成所有操作后,重新启动Android Studio,并让IDE完成其所有索引编制和其他任务,然后打开Firebase助手(“工具”>“ Firebase”)