-
Notifications
You must be signed in to change notification settings - Fork 2
2. Creating A Company App
LAST UPDATED: June 13, 2018
MajiFix uses app flavors to create branded versions of an app. This means the core of the MajiFix Android Application can be found in the main directory (app/src/main). This code in this directory is shared between all MajiFix based applications.
Company specific and company branded information (company name, logos, payment information, the server endpoint, etc) are not in the core of the MajiFix application. Instead these resources are placed in app flavors.
App flavors are defined in the app level build.gradle file, and flavor specific assets have their own flavor directory, for example: app/src/MYCOMPANY.
This pattern is used so that if a bug is fixed in the core code, it can be fixed in all company instances with a simple git pull, with minimal code clashes.
If you haven't yet downloaded the main android repo, please do that now. We use a version control system called Git which we use to keep track of changes, and work with a remote team. More information on Git can be found here.
To download the MajiFix repository, open a terminal and do the following:
# navigate to the directory where you wish to download the repository
cd MY_DIRECTORY
# clone the repository
git clone ''
Now it's time to create your own an app flavor:
-
Add a new flavor to the
app/build.gradlefile. Replace<COMPANY_NAME>with your company variant name:android { productFlavors { mycompany { dimension COMPANY applicationIdSuffix ".<COMPANY_NAME>" versionNameSuffix "-<COMPANY_NAME>" versionCode 1 versionName "1.0" resValue "string", "content_provider", "com.github.codetanzania.<COMPANY_NAME>.provider" ext { buildconfigs = [ [type: 'String', name: 'END_POINT', values: [debug: '<DEBUG_ENDPOINT>', release: '<RELEASE_ENDPOINT>']], [type: 'int', name: 'MAJIFIX_TOKEN', values: [debug: '<DEBUG_TOKEN>', release: '<RELEASE_TOKEN>']] ] } } -
Add a flavor directory. Directory structure (in
Projectview) should now look like:- dawasco-v2 - app - src - androidTest - main - <COMPANY_NAME> - testNote: Name of directory must match name defined in
build.gradlefile.
-
Add launcher icon. The launcher icon is the image shown on the Android Home Screen.
- Generate the image in the image editor of your choice.
- To import to Android Studio Import an Image Asset (
File > New > Image Asset) - In the Configuration Dialog, select the image you have created.
- Click Next.
- Fix config
-
Add company logos.
-
Add company assets (contact us, payment info, etc).
-
Add custom strings. It is required to override the following strings:
To build your custom flavor, click the Build Variants tab on the lower right side of Android Studio. Update the app BuildVariant to be MYCOMPANYDebug. Build app normally, for example: press the green play button.