Unresolved reference: FlutterActivity

Viewed 11906

I was researching a bit about writing native code in flutter. On opening the MainActivity.kt file in android I faced these issues.

enter image description here

On highlighting the error it showed 'Unresolved reference: FlutterActivity'.

Can someone please help me to fix this issue ?

Thankyou in advance.

2 Answers

I got the solution for this.

If you want to write native code or edit existing native code you have to open the "android" part of your project specifically.

You can do that be going to : File -> Open .....

Then browse to your current project and select its "android" folder and open it :

enter image description here

Then click "OK".

It will open the android native part of your project. All the errors will be gone if you will open the MainActivity through this path.

just open it in android project view in a new window then finish it until it build. then if you get any error debug it there. but if it is built successfully and shows an error in flutter project view leave it it is just the editor bug. [1]: https://i.stack.imgur.com/BGkrc.png

Related