You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't resolve symbol io.flutter.plugin dependency #19830
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.
Reacted by Mahesh Kumar, Christoph Krassnigg, Mohamed Gaber, jan tagadiad, Med Kadhem Mansour, SIMON GOMES, ChrisDEV, Jameson Williams, LX, Galih Suryo and 35 more
PS C:\Users\Anton> flutter doctor -v
[√] Flutter (Channel master, v0.5.8-pre.79, on Microsoft Windows [Version 10.0.17134.48], locale en-US)
• Flutter version 0.5.8-pre.79 at C:\Users\Anton\Documents\flutter
• Framework revision bb338ef2c6 (7 days ago), 2018-07-19 07:24:06 -0700
• Engine revision 5557e3006e
• Dart version 2.0.0-dev.67.0.flutter-84ca27a09e
[!] Android toolchain - develop for Android devices (Android SDK 28.0.0)
• Android SDK at C:\Users\Anton\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
X Android license status unknown.
[√] Android Studio (version 3.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 26.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
[√] VS Code, 32-bit edition (version 1.24.1)
• VS Code at C:\Program Files (x86)\Microsoft VS Code
• Flutter extension version 2.16.0
[!] Connected devices
! No devices available
! Doctor found issues in 2 categories.
has anyone else had to deal with this? I am not able to build the project in android studio because of those missing symbols.
Reacted by Gannon, Darel Bitsy, mirkancal, Daniel Wolf, kishan V, Iurii Dorofeev, Milen Dimitrov, Pascal Schmitt, Mahesh Kumar, Christian Wallenwein and 32 more
I found a workaround by adding the cached flutter.jar file as a library located in flutter\bin\cache\artifacts\engine\android-x64.
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.
Reacted by Amr Abdelwahab, Rui Liu, SQSong, Emerson Siega, Nazar Kokhan, XuanTung95, Ali bagheri, hunter2009pf, vuhung3990, Navid Shokoufeh and 2 more
Reacted by Trần Vương Quyền Phong and Artem Golovin
I found a workaround by adding the cached flutter.jar file as a library located in flutter\bin\cache\artifacts\engine\android-x64.
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.
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 example/android folder in Android studio. Now I can build the project and I can unittest my plugin from Android studio without adding the flutter.jar.
What I did step for step:
delete the .idea folder in the project (do not know if is needed but just to be sure)
in Android Studio click on 'Open an existing Android studio project' and select the folder your_plugin/example/android
If you want to build your library through gradle you can run ./gradlew :your_plugin:assembleDebug
Reacted by see--, Karthick Chinnathambi, Ishan Khanna, Vu Luong Trieu, Maksim Zadorskii, Shahzad Akram, Allan Nava, Jakub Trzebiatowski, Ajay Mourya, Andy and 41 more
Reacted by Sander Roest, SardorbekR, Emerson Siega, Andres Maldonado, Mxsyx, Pedro Massango, Victor Baxan, agilst and Muhammad Bani Akram
Reacted by Shahzad Akram, Andy, Santiago, Yonatan Naor, Yuqing Chen, joseph-neeraj, yasalkhatib, Hassan Farrokhi, xnio94, Ibrahim Eid and 12 more
I had the same problem but then I found out that the flutter plugin package is recognised when you open the example/android folder in Android studio. Now I can build the project and I can unittest my plugin from Android studio without adding the flutter.jar.
What I did step for step:
1. delete the .idea folder in the project (do not know if is needed but just to be sure)
2. in Android Studio click on 'Open an existing Android studio project' and select the folder `your_plugin/example/android`
If you want to build your library through gradle you can run ./gradlew :your_plugin:assembleDebug
I'm also having the same issue, I'm trying to add flutter to our existing gradle project, it's a really big project.
The flutter plugin need to include another local library which has the platform feature to be used but since gradle can't see the flutter sdk dependency the code does not compile... I don't understand why the flutter team does not provide gradle dependency for the flutter sdk...
We really want to move our ios and android project to flutter its seems that the tooling is not ready yet...
For those who are confused, why opening the the your_plugin/example/android would allow you to fix this issue and continue editing your plugin, here is the explanation: #11632
Basically, when you open the example/android module, the gradle script will simultaneously attached the plugin directory in the current project and you can edit from there.
Reacted by Lars, suragch, tolotrasamuel, Jonny, @lirez@, Md Azharuddin, Arvil Agomaa, Emerson Siega, mmakmw, Pedro Massango and 2 more
This structure is not great if you want to integrate it to another native project.
This break the following use case :
Mutlit module android root project -> flutter module <- flutter plugins.
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 flutter example app won't compile.
The only easy solution would be to publish the module to mavenLocal and then access it in the flutter android library build.gradle...
[√] Flutter (Channel beta, v1.7.8+hotfix.4, on Microsoft Windows)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.4)
Reacted by mirkancal, kishan V, Corey Cole, Norbert Sándor, Phani Rithvij, Aladdin, Vlad, xiemeilong, incloudss, LocaFoxNick and 3 more
Reacted by Norbert Sándor, Erich Garcia Payares and Lomash Dubey
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.
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.
When creating a flutter plugin project called 'hello'
Before editing the Android platform code in Android Studio, first make sure that the code has been built at least once (in other words, run the example app from your IDE/editor, OR in a terminal execute cd hello/example; flutter build apk --config-only).
After that
Launch Android Studio.
Select Open an existing Android Studio Project in the Welcome to Android Studio dialog, or select File > Open from the menu, and select the hello/example/android/build.gradle file.
In the Gradle Sync dialog, select OK.
In the Android Gradle Plugin Update dialog, select Don't remind me again for this project.
The Android platform code of your plugin is located in hello/java/com.example.hello/HelloPlugin.
This worked for me!
Reacted by Code-Remote, Greg Price, Arley011, Mohsen and VictorHenzzo
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
zoechi commentedon Jul 26, 2018
Please post the output of
flutter doctor -v.abacaj commentedon Jul 26, 2018
abacaj commentedon Jul 27, 2018
has anyone else had to deal with this? I am not able to build the project in android studio because of those missing symbols.
abacaj commentedon Jul 27, 2018
I found a workaround by adding the cached flutter.jar file as a library located in
flutter\bin\cache\artifacts\engine\android-x64.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.
rahulgul8 commentedon Aug 20, 2018
https://stackoverflow.com/questions/25660166/how-to-add-a-jar-in-external-libraries-in-android-studio
this helped me.
I had to get the jar from flutter\bin\cache\artifacts\engine\android-arm instead of x-86
rohitgupta1694 commentedon Nov 28, 2018
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?
remonh87 commentedon Jan 4, 2019
I had the same problem but then I found out that the flutter plugin package is recognised when you open the
example/androidfolder in Android studio. Now I can build the project and I can unittest my plugin from Android studio without adding the flutter.jar.What I did step for step:
your_plugin/example/androidIf you want to build your library through gradle you can run
./gradlew :your_plugin:assembleDebugkartdroid commentedon Mar 1, 2019
I guess this is the proper way for now
bitsydarel commentedon Mar 17, 2019
I'm also having the same issue, I'm trying to add flutter to our existing gradle project, it's a really big project.
The flutter plugin need to include another local library which has the platform feature to be used but since gradle can't see the flutter sdk dependency the code does not compile... I don't understand why the flutter team does not provide gradle dependency for the flutter sdk...
We really want to move our ios and android project to flutter its seems that the tooling is not ready yet...
tolotrasamuel commentedon Mar 19, 2019
For those who are confused, why opening the the
your_plugin/example/androidwould allow you to fix this issue and continue editing your plugin, here is the explanation:#11632
Basically, when you open the example/android module, the gradle script will simultaneously attached the plugin directory in the current project and you can edit from there.
bitsydarel commentedon Mar 20, 2019
This structure is not great if you want to integrate it to another native project.
This break the following use case :
Mutlit module android root project -> flutter module <- flutter plugins.
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 flutter example app won't compile.
The only easy solution would be to publish the module to mavenLocal and then access it in the flutter android library build.gradle...
amorenew commentedon Aug 5, 2019
I still face the same issue in August 2019
westracer commentedon Aug 6, 2019
Same issue. Importing flutter.jar fixes resolving, but then project fails to build.
71 remaining items
yullg commentedon Jun 12, 2024
我在Windows系统下遇到过相同的问题,似乎是项目代码和PUB的缓存目录在不同的磁盘分区导致的。通过PUB_CACHE环境变量将PUB缓存目录修改为和项目代码在相同的磁盘分区后恢复正常。
Code-Remote commentedon Jun 12, 2024
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.
Code-Remote commentedon Jun 12, 2024
@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.
Code-Remote commentedon Jun 14, 2024
@SEGVeenstra found the solution, you will never guess, apparently if you read the documentation very carefully (😅 🤦♂️) You will succeed!
https://docs.flutter.dev/packages-and-plugins/developing-packages#step-2b-add-android-platform-code-kt-java
When creating a flutter plugin project called 'hello'
After that
This worked for me!
yusuphwickama commentedon Jul 2, 2024
@Code-Remote,
At this point, the plugin generation command should automatically run the extra
flutter build apk --config-onlycommand after generating the project.rekire commentedon Jul 25, 2024
I might found a nice workaround. Check my comment here: flutter/flutter-intellij#7487 (comment)
canxin121 commentedon Oct 8, 2024
Do not open project/android, instead open project/example/android.
Resolve resolve native Flutter dependencies in Android Studio (#167332)
github-actions commentedon Jun 18, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.reidbaker commentedon Oct 15, 2025
Reopening due to #177053
Add migration guide for moving the gradle files (flutter#12203)