Getting the list of Android Studio package names

I'm working on a plugin for android studio, and I'm looking to figure out how to determine the build.gradle project names.  Normally, it's easy to get the project's name in the workspace via the project or module objects, but android studio projects have the extra trickiness that they may compile one app into multiple flavors. (Free, enterprise, etc), each with different ids.

Is there any way to access this information?


What exactly do you mean by build.gradle project names?


Each variant of flavor and buildtype in the workspace potentially has a different runtime package name defined by the build.gradle.  Is there a way to extract these via the open api?


Via Open API, no. All of the Android-Gradle stuff is in the Android plugin, and I can't see it ever see Android-specific stuff making its way into platform definitions like that.

I haven't developed an IJ plugin before so I don't know the rules, but presumably you could have your code depend on the Android plugin, and you could rummage around in there for what you want. Having said that, we don't have published external APIs that we're committed to, so if you try to depend on our internal data structures, you'll break every time we refactor things. For that reason I'd strongly discourage that approach as well.

Sorry, there just isn't a good answer for you right now.


Please sign in to leave a comment.