1

我似乎无法让 Firebase Assistant 在 Android Studio 中工作并出现以下错误。

例外

无效的
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) 在 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。在 com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:424) 在 com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator. java:407) 在 java.awt.Event.InvocationEvent.dispatch(InvocationEvent.java:311) 在 java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762) 在 java.awt.EventQueue.access$500(EventQueue.java: 98) 在 java.awt.EventQueue$3.run(EventQueue.java:715) 在 java.awt.EventQueue$3.run(EventQueue.java:709) 在 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) 在 java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) 在 java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) 在 java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java: 101) 在 java.awt.EventDispatchThread。泵事件(EventDispatchThread.java:93)在 java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

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

我的配置如下。

在此处输入图像描述

构建.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'

发布规范.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

4

2 回答 2

0

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

于 2018-05-02T20:41:38.760 回答
0

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

  • 安卓工作室 3.1 -> 3.2
  • 我已经安装的所有 SDK 工具(工具 > SDK 管理器 > SDK 工具)
  • Flutter 和 Dart 插件(Preferences > Plugins)

我还尝试了贾斯汀关于卸载 Firebase 插件、重新启动然后重新安装的答案。

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

于 2018-10-06T02:34:15.623 回答