Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter dependency in java plugin

I have opened android plugin of Firebase Auth but I cannot access flutter dependencies. What can I do to be able to use features like autocomplete?

When I run the code, everything works fine.

enter image description here

like image 938
Marcin Szałek Avatar asked Sep 06 '25 20:09

Marcin Szałek


2 Answers

Alright, there is an easy solution for that!
Open Android studio and open the map viewer and make sure you are in the Project view. Picture showing project view

Now create a new directory and call it something like tmplibs. enter image description here

Alright, now navigate to your Flutter SDK directory. So where you cloned the Flutter repo. Then open the bin folder, after that the cache folder, followed by the artifacts folder, now open the engine folder and finally open the android-x64 folder.
So the path will look something like this:

...\flutter\bin\cache\artifacts\engine\android-x64  

In here, you'll find a file called flutter.jar. Copy that and paste it in your new tmplibs folder! enter image description here

Now right click on the flutter.jar file in project view in Android studio and click on Add As Library... enter image description here

Now open your module settings enter image description here

Finally click on Dependencies and changes the scope of tmplibs/flutter.jar to provided.
enter image description here

That's it!

like image 75
Bram Vanbilsen Avatar answered Sep 10 '25 13:09

Bram Vanbilsen


A better solution is to use the android project of the example app instead of the library. See this issue response on github: https://github.com/flutter/flutter/issues/11632

like image 32
Luigi Agosti Avatar answered Sep 10 '25 13:09

Luigi Agosti