android - How to generate different APK -


i want use same project create 2 different apk(for example a.apk , b.apk).so changed "package" in manifest , "applicationid" in build.gradle. problem android phone warning me unstalled a.apk when installed b.apk. why? a.apk , b.apk has different package. a.apk's main package name "com.meimei.a",and b.apk's main package name "com.quanquan.b". still can n't install a.apk , b.apk in same phone.

this can accomplished using productflavors in build.gradle , changing application's applicationid each flavor.

productflavors {     appstaging {         applicationid "com.android.appname.staging"     }     appproduction {         applicationid "com.android.appname"     } } 

building specific flavor using above should result in separate apks can installed side-by-side.

in addition, can change source want in these apks doing following:

sourcesets {     appstaging {         manifest.srcfile 'src/main/appstaging/androidmanifest.xml'         java.srcdirs = ['src/main/java/ui', 'src/appstaging', 'etc']         resources.srcdirs = ['src/main/res']     }     appproduction {         manifest.srcfile 'src/main/app/androidmanifest.xml'         java.srcdirs = ['src/main/java/ui', 'src/app', 'etc']         resources.srcdirs = ['src/main/res']     } } 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -