Importing aar file directly in flutter project is easy and straight-forward but in flutter plugin its not. When importing aar file in flutter plugin I get the following error : -
Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error).
This issue can be solved using the following command : -
compileOnly fileTree(dir: 'libs', include: ['*.aar'])
but this line only complies the file but when using it in a project it file wont get imported.
How can I import aar file in flutter plugin ?
I have scrutinized each and every solution but nothing works. Solution of following links did not work : -
How to Import AAR file in the flutter plugin?
How to use local aar inside flutter plugin?
If you have the source code for this aar, you can publish it as a library to maven local. Then, include it like any other Maven dependency, and use
implementationinstead ofcompileOnly.