I currently have a Flutter app that gives an error in VSCode; the project itself builds for Android without issue. The issue appears to plague solely the VSCode editor and is down to there being a sub-project within the main project for Android. This is because I’ve nested (copy & pasted) a custom flutter package into the local file structure, and the local flutter package includes an example project.
Ideally I’d like to not delete the "example" directory from the nested local package, I’d like VSCode to just relax. Is there a way to deactivate these warnings?
Update: By recreating the package using the plugin commands, as suggested below, the root issue still remains though the error text has changed slightly to be as shown below:
The supplied phased action failed with an exception.
A problem occurred evaluating settings 'android'.
A problem occurred evaluating script.
assert pluginDirectory.exists()
| |
| false
2
Answers
The issue come from the way that you have created the package in the first place.
If you follow the guide here https://docs.flutter.dev/development/packages-and-plugins/developing-packages#plugin you will notice that the issue will disappear.
I think best approach is to create the package again with the command like
flutter create --org com.example --template=plugin --platforms=android,ios,linux,macos,windows -a kotlin hello
and copy after your lib/tests files in the respective folders or main lib and example.Try disabling the VS Code extension "Language Support for Java(TM) by Red Hat" if you have installed it. I had the same issue and disabling that extension solved it.