Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Cannot resolve symbol 'embedding' and Cannot resolve symbol 'FlutterActivity'

error shown in Flutter Android project folder in mainactivity

package com.malik.database_demo;

import io.flutter.embedding.android.FlutterActivity;

public class MainActivity extends FlutterActivity {
}
like image 546
Informative Programmer Avatar asked Oct 21 '20 16:10

Informative Programmer


2 Answers

Currently you are probably trying to directly edit the MainActivity class from your Flutter project. (By expanding android -> Navigation to 'MainActivity.java' or 'MainActivity.kt' and editing it).

I have observed that when we try to edit the native side code this way, Flutter is not able to recognize the android part.

What you can do is open the 'android' part of your flutter project and then edit it.

To achieve this :

  1. Click File -> Open -> Navigate to your current Flutter project -> Expand it and find the android part (refer the example below)

enter image description here

[1 = Your current Flutter project,2 = The android part of your flutter project]

  1. Click on that android part and click Open. Wait for the indexing and all to complete and then I dont think it will give those errors.

GLHF :)

like image 69
Sarvesh Dalvi Avatar answered Nov 15 '22 08:11

Sarvesh Dalvi


I added flutter.jar as a library. This seemed to work.

I'm not sure if there are some unintended consequences yet!

like image 44
dbarton_uk Avatar answered Nov 15 '22 09:11

dbarton_uk