I have two apps that shares same functionality except images,icons,colors,app name and package change and the URL that gets called in the event of network activity.
In iOS we can create two different apps easily from one source code by using the power of targets.
Here is the link on How to do it in iOS
But how to go about it in android
You should leverage product flavors for this.
In your build.gradle, you will define the flavors like so:
android {
productFlavors {
brand1 {
// ...
}
brand2 {
// ...
}
}
}
You can then create flavor specific resources. If you are creating an icon called ic_launcher.png
for example, you would typically put it at a location such as main/res/drawable-xhdpi/ic_launcher.png
. Instead, you could put the brand1 version at brand1/res/drawable-xhdpi/ic_launcher.png
and the brand2 version at brand2/res/drawable-xhdpi/ic_launcher.png
.
When you run gradlew build
, it will build all variants. You can also build specific variants such by specifying the variant name like so: gradlew assembleBrand1Debug
. In Android Studio you can select the variant you want to see using the "build variants" pane.