代码之家  ›  专栏  ›  技术社区  ›  iPatel

flutter无法在设备上运行app import androidx.annotation.nullable

  •  2
  • iPatel  · 技术社区  · 6 年前
    Initializing gradle...
    Resolving dependencies...
    Gradle task 'assembleDebug'...
    registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
    registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
    registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
    registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
    registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
    /Users/ipatel/Documents/AAAA/FlutterSetup/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.9.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:9: error: cannot find symbol
    import androidx.annotation.NonNull;
                              ^
      symbol:   class NonNull
      location: package androidx.annotation
    /Users/ipatel/Documents/AAAA/FlutterSetup/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.9.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:10: error: cannot find symbol
    import androidx.annotation.Nullable;
                              ^
      symbol:   class Nullable
      location: package androidx.annotation
    /Users/ipatel/Documents/AAAA/FlutterSetup/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.9.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:253: error: cannot find symbol
              public void onFailure(@NonNull Exception e) {
                                     ^
      symbol: class NonNull
    /Users/ipatel/Documents/AAAA/FlutterSetup/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.9.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:274: error: cannot find symbol
                        public Void apply(@NonNull Transaction transaction)
                                           ^
      symbol: class NonNull
    /Users/ipatel/Documents/AAAA/FlutterSetup/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.9.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:272: error: cannot find symbol
                        @Nullable
                         ^
      symbol: class Nullable
    /Users/ipatel/Documents/AAAA/FlutterSetup/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.9.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:503: error: cannot find symbol
                        public void onFailure(@NonNull Exception e) {
                                               ^
      symbol: class NonNull
    /Users/ipatel/Documents/AAAA/FlutterSetup/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.9.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:558: error: cannot find symbol
                        public void onFailure(@NonNull Exception e) {
                                               ^
      symbol: class NonNull
    7 errors
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':cloud_firestore:compileDebugJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.
    
    * 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 4s
    Finished with error: Gradle task assembleDebug failed with exit code 1
    

    不知道为什么会发现上述错误?我只是试着连接系统中的设备并运行。

    以前我尝试在没有安装Android Studio的情况下,通过VS代码在设备上运行应用程序。所以我跟着 https://medium.com/@aubykhan/setting-up-flutter-without-android-studio-6f7abdeb353c 本教程按终端手动安装Gradle。

    以下是我的终端的一些历史记录:

    431 BREW安装渐变
    432酿酒桶安装Java
    433 BREW安装渐变
    434颤振配置——梯度方向/usr/local/opt/gradle
    435颤振——版本
    436清
    437颤振医生
    438 sdkmanager“系统映像;android-21;默认值;x86_”
    439 vi~/.bash_简介
    440打开$home/.bash_配置文件

    我想问题可能是系统找到了两条路还是其他问题?不知道,但我怎样才能解决这个问题?

    1 回复  |  直到 6 年前
        1
  •  1
  •   Günter Zöchbauer    6 年前

    如受影响的官方插件的changelog中所述,您需要迁移到androidx。 https://pub.dartlang.org/packages/firebase_core#030