Changing the package name depending on the build configuration.

I'm currently building an app that will target release, test and dev instances of my server depending on the current build configuration. I would like to be able to install these side by side on my phone which I think requires a different package name. I'm unsure how to do this since the method I used for targeting servers (compiler directives) can't be used within the android manifest xml.

I have done some searches found this, is there a way this can be done with Xamarin?


  • I have nearly the same problem. I have a app and their is a theme for another company that uses our app with a layout made for them.
    I can change the appname, icon, etc all via XML attributes. But i cant find a attribute that allows me to change the package name.
    Switching it by creating another build configuration in the visual studio doesnt work also because if you change the package name setting in one configuration its changed in all others too

  • JeremyEllis.9126JeremyEllis.9126 USUniversity ✭✭

    @JohannesSchmidt - I was hoping to also change the app name/icon etc. as well. Can you show me how you do that via xml attributes, please.

  • JohannesSchmidtJohannesSchmidt USMember
    edited September 2014 should help you
    right under my using declarations over the declaration of the namespace of my mainactivity i have something like

    [assembly: Application(
    if THEME_ONE
    Label = "Label 1",
    Icon = "@drawable/icon_one"
    if THEME_TWO
    Label="Label 2",
    Icon = "@drawable/icon_two"

    i postet it without the '#' chars
    when using the '#' before the if and endif the forum formats it in a strange way

  • AndrewNemtsevAndrewNemtsev USMember ✭✭

    works, just a little addition:
    for successfull run of script in PreBuild task it's necessary to adjust execution policy: "PowerShell -ExecutionPolicy Unrestricted -File ..."

  • JonasStawskiJonasStawski USDeveloper Group Leader ✭✭

    A more built in (and cross platform) solution is to use xbuilds AndroidManifest property:

    I use it like so: /p:AndroidManifest=Properties/AndroidManifestAlpha.xml

  • jatinsingh0000jatinsingh0000 INMember Should Definitely help you to understand how to How To Change Package Name In Android Studio

Sign In or Register to comment.