My situation is that I want both free and full versions of the same Google Play Store (GPS) app. To satisfy GPS, I had the choice of figuring out GPS API for in-app purchases or creating a second package. I chose the latter path since the former was far from easy to follow (couldn't implement after trying for parts of 3 days).
Before realizing that a second package would be necessary, I had designed the app so that merely changing two imports (package names), one boolean assignment (FREE: true or false), and a couple of lines of AndroidManifest.xml
(icon and app name) I could easily change the code from free to full and back again.
All well and good. Then came first bug: actionbar overflow "dashes" didn't appear on a tablet.
So I have two hunks of 99%-identical java and xml code. When I find the need to change code in future, I don't want to have to make two probably-identical changes. And figuring out the GPS API is not likely to penetrate my brain anytime soon.
In trying to answer my own question before posting, I just ran across this here, without further explanation:
I was using Android Libraries to build Free/Paid versions of my app. [With] the new Gradle Build Variants concept... you can now automatically build different signed APKs out of the same code.
It received an upvote, but that doesn't make it credible.
Is it?
If it is, I'm also not sure if it applies to me. The message from GPS when I made the changes alluded to earlier within the same package was that I needed different package names for the free and full versions, and that quote doesn't mention packages, although maybe it's a way around separate packages. I wish I knew.
If the quote applies to having ONE package upload TWO versions of an app to GPS, what do I have to do to make gradle do so?
EDIT--
I was sure there was no way until I found this. Is this a way to avoid near-duplicate apps and packages?