0

Is there a way to get the real package name when running a flavored versions of an android app?

I writing and library and in this library I want to get the the app package name for some reason. When I call getPackageName() it returns com.example.app.. I want to always get com.example.app without the flavor name. Is there a way to do that ?

mnagy
  • 1,085
  • 1
  • 17
  • 36
  • 1
    There is no "without the flavor name" version of the application ID, if the app developer elects to override the application ID on a per-flavor basis. – CommonsWare Nov 22 '15 at 17:02

1 Answers1

1

This is what used to be the behavior before Gradle plugin 2.x

But when you use e.g. classpath group: 'com.android.tools.build', name: 'gradle', version: '2.2.1' then (when using the Linux platform tools - but not on OS X) getPackageName() returns the flavor-specific "package" (applicationId) instead of what you defined in the app's manifest (package field).

Gabor
  • 7,352
  • 4
  • 35
  • 56