I\'m building a gradle plugin that adds a new task for every application variant. This new task needs the package name of the application variant.
This is my current cod
The only way I found was to define packageName
in the project's build.gradle
and then from the plugin do project.android.defaultConfig.packageName
.
If the project has flavors that define their own package then the solution stated by stealthcopter would work.
However a plugin is meant to work with any project regarless whether packageName
is defined or not in build.gradle
so these solutions are far from ideal.
Let me know if you find something better.