5

I created a flutter plugin for android and ios using the following command:

flutter create --org com.docscanner.ds --template=plugin --platforms=android,ios -i swift -a java complete_pdf_tools

The operation was carried out smoothly and then I opened android studio and clicked on the option Open and selected the folder created by the above command. The project opened but it shows error everywhere in all the .java files.

And also all the folders and files on the left are in yellow except lib folder.

This is how it looks: enter image description here

I tried Invalidate Caches and android studio restart and system restart but no good. If I move cursor on top of any red colored word for example on embedding in 3rd line it says Cannot resolve symbol 'embedding' and for actions it suggests Find JAR on web and if I click on that action it says looking for Libraries and then says No libraries found for 'import io.flutter.embedding.engine.plugins.FlutterPlugin;'

The error is in .java files only. Same thing happens if I try to create the plugin from android studio itself by going New Flutter Project>and then it asks me for flutter sdk path, which is C:\src\flutter>now for project type i select plugin and select java for android and swift for ios, give project name, org name and finish

I am using windows 10 x64, flutter version stable 2.10.2, and Android Studio version Bumblebee 2021.1.1 Patch 1

What could be the cause of these errors.

3
  • 1
    open editing in android studio will open android code directly . Commented Mar 5, 2022 at 8:33
  • 1
    That opens this java file along with its parent directories in new window and all errors are gone as well. But why is it showing errors here. This is Android studio too. And why do I have to open them in separate windows. I was watching videos on YouTube about how to create flutter plugins but I didn't see anything like this in any of those videos. Commented Mar 6, 2022 at 9:21
  • may be proper indexing the package Commented Mar 6, 2022 at 9:35

1 Answer 1

2

Open example/android/build.gradle instead of android/build.gradle, then you have both app and plugin in your Project.

Sign up to request clarification or add additional context in comments.

1 Comment

But I still don't understand the cause of these errors. In this image at the top right it says 'Open for Editing in Android Studio'. What does that mean, this is android studio. And if I click on it, this file, along with its parent directories, opens up in a new Android Studio window and all errors are gone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.