-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Can't resolve symbol io.flutter.plugin dependency #19830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Please post the output of |
|
has anyone else had to deal with this? I am not able to build the project in android studio because of those missing symbols. |
I found a workaround by adding the cached flutter.jar file as a library located in Not sure if this is the correct approach since it is the cached version and will need to be manually replaced each time, but it does resolve the symbols for me while editing. |
this helped me. I had to get the jar from flutter\bin\cache\artifacts\engine\android-arm instead of x-86 |
In order to resolve flutter dependencies in Android Studio, we need to a flutter.jar file from the flutter project. I also did the same. But, Is it a good way to do it? @zoechi What effect can it have on our flutter project apart from size? |
I had the same problem but then I found out that the flutter plugin package is recognised when you open the What I did step for step:
If you want to build your library through gradle you can run |
I guess this is the proper way for now |
I'm also having the same issue, I'm trying to add flutter to our existing gradle project, it's a really big project. |
For those who are confused, why opening the the |
This structure is not great if you want to integrate it to another native project. This break the following use case : If a flutter plugin need to access native features provided by a module in the root project. including the module in the flutter plugin settings.gradle won't work. The only easy solution would be to publish the module to mavenLocal and then access it in the flutter android library build.gradle... |
I still face the same issue in August 2019
|
Same issue. Importing flutter.jar fixes resolving, but then project fails to build. |
@zoechi some issues should not be prioritized by how many likes |
Have the same problem: Plugin folder is inside the main project root, i'm unable to debug my plugin with native Android code.
I see in local properties there is a flutter.sdk variable, with my local flutter sdk installation but it appears to be unused. |
@davidBarbieri just use this line and comment it when you start building https://github.com/amorenew/flutter_zkteco_fingerprint/blob/master/android/build.gradle |
Any solution for this issue ? |
As I understand the issue, Android Studio can't find dependency to flutter SDK. A solution which works for me based on this issue - #18983
After manipulation above, flutter.jar library should be connected with your project and imports should be available. |
cc @devoncarew |
Thanks @keenawl, your commit is a good example of how to fix this. On Windows, I also had to define FLUTTER_ROOT environment as it still needed this even though Also changing the source to be:
means it can build in VSCode and Android Studio. The |
@dkaera....You my friend, are a genius... |
Unfortunately not. The current workaround I use is that I open the /example folder of the plugin and copy there the content of myplugin.kt in the MainActivity.kt. edit there and copy the changes afterwards into the plugin.kt and reset the MainActivity.kt. a very strange process, but the only one that currently works for me. |
Why is this so hard? Why is this 2 years old? Why am I unable to use my google editor for a google sdk that is supposed to support this? None of the workarounds work here. Can we talk solutions? |
This workaround is working for me. Go through the link and try the steps. Also, comment the implementation line after building the plugin. |
You sir are a life saver. Thank you so much! |
@gmackall You really save my life! Thank you. |
![]() I have done the same steps @gmackall has suggested. but still, I'm able to see different structures. |
This comment was marked as abuse.
This comment was marked as abuse.
The solution is just to open the example/android project that one includes the plugin itself. Crazy that this is still a thing. |
Hi @Nilav2608 and others facing the same issue, the only possible solution which worked for me was to edit the plugin related files from within the following path : Also, if you previously tried accessing the |
Thanks @Ldev007 , that's the only solution which helped me
If I open the It's a shame, 6 years have passed, and this bug is still not resolved. |
How do you even get that plugin folder to show up?
But I only get the App project... |
我在Windows系统下遇到过相同的问题,似乎是项目代码和PUB的缓存目录在不同的磁盘分区导致的。通过PUB_CACHE环境变量将PUB缓存目录修改为和项目代码在相同的磁盘分区后恢复正常。 |
I've tried with different Android Studio versions (Koala rc, Jellyfish patch 2 and 1, Iguana) and different flutter versions (3.22.2 and 3.13.8) and I keep on getting the same unresolved errors. I checked stack overflow(https://stackoverflow.com/questions/56965783/flutter-plugin-development-unresolved-reference-io) and all I can find is people saying to delete the .idea folder and open the android folder that is inside of my flutter project as a separate project in Android Studio, but still the lines stay red and keep the "Unresolved reference: io" Also, when I have my flutter project open and navigate to the MyPlugin.kt file inside of the android folder that is in the root of my Flutter project it shows this message "Open for Editing in Android Studio", but when I click it nothing happens. |
@yullg, can you explain the exact steps you've taken to do that and how that can be done on macOS? yullg's message translated > I encountered the same problem in Windows system. It seems that the project code and PUB cache directory are in different disk partitions. After changing the PUB cache directory to the same disk partition as the project code through the PUB_CACHE environment variable, it returned to normal. |
@SEGVeenstra found the solution, you will never guess, apparently if you read the documentation very carefully (😅 🤦♂️) You will succeed! When creating a flutter plugin project called 'hello'
After that
This worked for me! |
At this point, the plugin generation command should automatically run the extra |
I might found a nice workaround. Check my comment here: flutter/flutter-intellij#7487 (comment) |
Do not open project/android, instead open project/example/android. |
Edit from Flutter team:
Please see #19830 (comment). If following these steps still doesn't resolve the imports, please add a comment with your Android Studio version and the output of
flutter doctor -v
Original issue:
I'm trying to build a flutter plugin in Android studio using an example template.
When I open the build.gradle in android studio and gradle resolves dependencies I cannot get these symbols to resolve:
I'm not sure what I'm missing as flutter doctor shows I have all checks.
The text was updated successfully, but these errors were encountered: