Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`Unresolved reference: android` on new Flutter project

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.

error

like image 564
Dave Avatar asked Dec 31 '18 23:12

Dave


People also ask

How do I add a jar file to Flutter?

Right-click on it, go to -> Flutter -> Open project in android studio. Go to File->Project Strucuture-> Dependencies. Select the name of plugin (you should ad dependency here, not in app or All Modules) Click on the "+" button to add a new dependency.

Can I develop Flutter app from Android studio?

Android Studio creates a fully working flutter application with minimal functionality. Let us check the structure of the application and then, change the code to do our task. Let us understand the dart code line by line. Line 1 − imports the flutter package, material.


2 Answers

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.

like image 146
Dave Avatar answered Dec 03 '22 09:12

Dave


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).

enter image description here

like image 27
Rohit Gurjar Avatar answered Dec 03 '22 10:12

Rohit Gurjar