Flutter无法在设备导入androidx.annotation.Nullable上运行应用 [英] Flutter fail to run app on device import androidx.annotation.Nullable

查看:800
本文介绍了Flutter无法在设备导入androidx.annotation.Nullable上运行应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

不知道为什么会发现以上错误"?我只是尝试在系统中连接设备并运行.

Don't know why Above Error found? I just try to connect device in my system and run.

以前,我尝试在未安装Android Studio的情况下通过VS Code在设备上运行应用程序.因此,我遵循了 https://medium.com/@aubykhan/setting-up-flutter-without-android-studio-6f7abdeb353c 本教程,并通过终端手动安装Gradle.

Perviously I tried to run app on device by VS Code without Android Studio Installed. So I have followed https://medium.com/@aubykhan/setting-up-flutter-without-android-studio-6f7abdeb353c this tutorial and manually installed Gradle by terminal.

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

Below are some history of my terminal:

431 brew安装gradle
432酿造木桶安装Java
433 Brew安装Gradle
434 flutter配置--gradle-dir/usr/local/opt/gradle
435扑--version
436清除
437扑医生
438 sdkmanager"system-images; android-21; default; x86_64"
439 vi〜/.bash_profile
440打开$ HOME/.bash_profile

431 brew install gradle
432 brew cask install java
433 brew install gradle
434 flutter config --gradle-dir /usr/local/opt/gradle
435 flutter --version
436 clear
437 flutter doctor
438 sdkmanager "system-images;android-21;default;x86_64"
439 vi ~/.bash_profile
440 Open $HOME/.bash_profile

我认为问题可能是系统找到了Gradle的两个路径还是其他问题?不知道,但是我怎么解决这个问题呢?

I thought issue might be is system found two path of Gradle or issue are others? Don't know but how can I figure out this issue ?

推荐答案

您需要迁移到受影响的官方插件的更新日志中提到的AndroidX

You need to migrate to AndroidX as mentioned in the Changelog of affected official plugins https://pub.dartlang.org/packages/firebase_core#030

这篇关于Flutter无法在设备导入androidx.annotation.Nullable上运行应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆