2

My question: How to get the build variant of an app hosting my AAR library code?

Background: - A method that returns an apps build variant should use: BuildConfig.BUILD_TYPE

  • I'm writing an SDK library. I want to know the build variant of the application hosting my library (mainly to avoid running my code in release variant).

  • BuildConfig.BUILD_TYPE is package dependant, I don't know the package of the app hosting me and BuildConfig has no getter. I can't ask for the host app's BuildConfig.

Eitan Schwartz
  • 463
  • 6
  • 19
  • your idea likely will fail. Why? `release` is just a name, which can be totally **anything**. For example I don't use the `release` build type for some of my projects. I call them `release`. Even more - you can name the build type `debug`, but configure it as release. So using build type to limit production usage of your lib is not going to work – Vladyslav Matviienko Nov 26 '18 at 09:05
  • As alternative, you may try this answer: https://stackoverflow.com/a/23844693/1568530 – Vladyslav Matviienko Nov 26 '18 at 09:10

0 Answers0