I have a Flutter
project where, all of a sudden, without me doing anything special as far as I can remember..the Android side has started to show an error, and I am totally lost, I have no idea at all of what is wrong or why that happened.
That is what I see when I open the android folder, the MainActivity
on the flutter project on android studio:
I have tried calling flutter clean
, restart/invalidate cache
, gradle clean
...and so far nothing works.
The weird thing is that the project actually runs in the emulator without any problem. And also, if I open the Android part independently on Android Studio i don't see any error.
Anyone had that before?
Android Studio version 3.3.1
Solutions of this answer do not work.
** ----- NOTE ----- **
The problem here can be (not sure at all maybe someone else can help here) that I am using a flutter package called ImagePicker
, which after some code investigation, it turns out that it is using some AndrodX imports
....and...as far as I am aware of...Flutter is not yet compatible with AndroidX
.
But i need someone else to confirm that in order to post a solution.
Solution 1: DevTard
This error is not really an error. This happens because android studio is set to read and edit dart not java. In order to edit the android side of a flutter project, you need to click on the android folder -> go to the flutter option -> click 'open in Android Studio'.
This will then allow you to edit the android side of your project.
Solution 2: Atul
Set Configure to the Android project SDK of flutter application
Step by Step
- Click on File -> Project settings then select appropriate API level as per your project will solve your issue