skip to Main Content

enter image description here

Firstly, Look at the screenshot that I’ve attached, It is giving me red lines (look to the right) in my entire code (386 errors in 766 lines) all of a sudden (This project was working perfectly fine last time I tested it), It is saying that the import package line is not valid, I thought it would be something with the SDK so I redownloaded Dart SDK but still getting the same error, I redownloaded flutter zip file and added it to my path, also updated it’s path in project settings still didn’t work, I tried running flutter doctor command and it is saying everything is perfect, I have selected Android SDK too still no help, I even tried reinstalling Android Studio, didn’t work either.

(Please help me out with it 🙁 My First Internship is starting soon and I cannot work without android studio)

I have a feeling that it has to do something with the configuration but I can’t figure out what to change :/

3

Answers


  1. Chosen as BEST ANSWER

    Actually It was very easy to fix, Just run

    flutter pub get
    

    It will work after running this command

    enter image description here


  2. Try any or all of these

    1. Try cleaning/rebuilding the project
    2. Change SDK path
    3. Go to your projects main folder in the file explorer and delete the .gradle. Close the project, reopen and let Android Studio redownload the deleted files.
    4. Update Android Studio
    5. Uninstall Android Studio and make sure to delete all Android Studio’s app data. Once you’ve done that go to the android page and download Android Studio from the so you have the latest version. Sometimes the IDE has old files that somehow affect your projects.
    6. Check your gradle-wrapper.properties in your app within Android Studio. Make sure the second line distributionUrl=https://services.gradle.org/distributions/gradle-7.2-bin.zip is the latest version which is 7.2.
    Login or Signup to reply.
  3. This happens to me sometimes. I do the following which usually fixes it.

    1. Click the build menu then Clean Project.
    2. Click file, Invalidate Caches.
    3. Check off all the options on the box that appears.
    4. Restart Android Stuido.

    The project will rebuild when Android Studio starts back up and the errors should be gone.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search