skip to Main Content

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?

File structure root->android(issue) and root->packages->package name->example->android

A project with the name android already exists.
The supplied phased action failed with an exception.
Duplicate root element android

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

New Error text: The supplied phased action failed with an exception. A problem occurred evaluating settings 'android'. A problem occurred evaluating script. assert pluginDirectory.exists()

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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.

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