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).
And when I rollover the onCreate
, it shows this:
Cannot access class 'android.Os.Bundle'. Check your module classpath for missing or conflicting dependencies.
I'm using AndroidStudio 3.2.1
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'
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.
There are a few things you can try:
open Android directory of your flutter project in android studio(new window). Then
Hope it helps:)
For the "Unresolved reference: android” Issue.
It occurs because the project is not able to configure the Android SDK.
And then,
ReSync the project. (Invalidate caches and restart, if required)
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.I managed to solve the problem by updating my Gradle version to the latest one (via Andorid studio), changing the ext.kotlin_version to 1.3.11 at build.grade(Project: android), and updating the SDK at Tools/SDK Manager/Edit
Configure to the project SDK to the appropriate API level as per your project will solve your issue(shown in the dialog after clicking Setup SDK at right corner).
If you are still facing Issues like