Lets say I have a white label app that Im converting to be built in android studio from eclipse. This app has about 10 iterations which all use mostly the same code base with different resources that all use the same name convention how ever some of the iterations have extra activities or services that arent needed in all builds.
I want to scrap the entire lot of old hard to maintain code bases which are all essentially the same and just use one android studio project. I understand the base of this set up with all the source files and res files but I'm stuck on how to handle the different manifest files.
Can I use flavors or buildtypes to handle the switching of multiple manifest files?
Your APK or Android App Bundle file can contain just one AndroidManifest. xml file, but your Android Studio project may contain several—provided by the main source set, build variants, and imported libraries.
A manifest can contain only one application node. It uses attributes to specify the metadata for your application (including its title, icon, and theme).
The Android manifest file helps to declare the permissions that an app must have to access data from other apps. The Android manifest file also specifies the app's package name that helps the Android SDK while building the app.
The manifest file is also where you can declare what types of hardware or software features your app requires, and thus, which types of devices your app is compatible with. Google Play Store does not allow your app to be installed on devices that don't provide the features or system version that your app requires.
Lets say I have a white label app that Im converting to be built in android studio from eclipse.
I have a white label app that Im converting to be built in android studio from eclipse.
Oh, no, wait — you didn't mean that literally...
:-)
Can I use flavors or buildtypes to handle the switching of multiple manifest files?
Absolutely. You can have manifests in the flavor and/or build type sourcesets (e.g., src/debug/AndroidManifest.xml
). Their contents will be merged in with the manifest in main
, the manifests in any attached AARs/Android library projects, and the various settings in build.config
to create The One True Manifest for any given build. There is a page that describes the merger process and how various attributes can help control it, though it's a trifle confusing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With