Add a dependecy in Android Studio project from plugin for the entire project

Hi,

I am creating a plugin which needs to add a dependency library to the project and modify the build.gradle files both at the module level as well as at the project level. For this I need to access the gradle files through code. I have already gone through this post

- https://intellij-support.jetbrains.com/hc/en-us/community/posts/206109229-Add-a-dependecy-in-Android-Studio-project-from-plugin.

However this method can be used to get the build.gradle file of a particular module. I need to get the build.gradle file of the project. What should i do?

 

Thanks for help!!

0
1 comment
Avatar
Permanently deleted user

I found a solution to this.

You can get your project's gradle file as a Virtual File. And initialize an object of GradleBuildFile using your virtual file as the parameter to the constructor.

0

Please sign in to leave a comment.