Yes, using the product Flavors mechanism.
You'll write:
android {
productFlavors {
flavor1 {
packageName "com.my.package.name.1"
}
flavor2 {
packageName "com.my.package.name.2"
}
}
}
With all your sources in the default source folder (src/main/java
) and the default manifest (src/main/AndroidManifest.xml
), you'll automatically get 2 apps which only differ in the package name in their manifest.
Documentation: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants