未解决的参考:新Flutter项目上的android [英] `Unresolved reference: android` on new Flutter project

查看:723
本文介绍了未解决的参考:新Flutter项目上的android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,我的第一个Flutter应用程序似乎可以在手机上调试正常,但是突然之间,我在android/app/src/main/kotlin/my.appname.whatever/MainActivity文件中看到了此错误(下面的屏幕截图).

My first Flutter app seems to be debugging okay so far on my phone, but all of a sudden I'm seeing this error in my android/app/src/main/kotlin/my.appname.whatever/MainActivity file (screenshot below).

当我将鼠标悬停在onCreate上时,它显示如下: Cannot access class 'android.Os.Bundle'. Check your module classpath for missing or conflicting dependencies.

And when I rollover the onCreate, it shows this: Cannot access class 'android.Os.Bundle'. Check your module classpath for missing or conflicting dependencies.

我正在使用AndroidStudio 3.2.1

I'm using AndroidStudio 3.2.1

在尝试使Firebase正常运行时,我更改了此版本(我认为是1.2.17,但警告说它与IDE不同,因此我将其更改为建议的内容,警告消失了. ).即使尝试将其改回,我仍然在下面收到警告.

While trying to get Firebase going, I changed the version of this (it was 1.2.17 I think, but had a warning about it being different than the IDE, so I changed it to what it suggested and the warning went away). Even after trying to change it back, I'm still getting the warning below.

buildscript { ext.kotlin_version = '1.3.11'

buildscript { ext.kotlin_version = '1.3.11'

我认为这很简单,但是对于刚接触Android/Flutter的人...等等,我只是不知道在哪里寻找Unresolved reference: android,也不知道我做了什么它出现了.

I assume this is something simple, but for someone very new to Android/Flutter...etc, I just don't have a clue where to look for the Unresolved reference: android, nor have any idea what I did to make it show up.

推荐答案

在我来说,File -> Invalidate Caches / Restart起作用了.当Android Studio开始备份时,问题就消失了.并没有真正回答为什么",但是...确实有效.

In my case, File -> Invalidate Caches / Restart worked. When Android Studio started back up, the issue was gone. Doesn't really answer the "why", but... it worked.

这篇关于未解决的参考:新Flutter项目上的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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