Multi Flavors(Android)/Target(iOS) in Xamarin

Hi,
I am working in an application for iOS and Android using Xamarin and now I need do a variant of them with small changes.

I had been worked with Android Studio and XCode and each one had a possibility to work with multiple application versions (Multi Flavors(Android)/Target(iOS) respectively) where you can replace some parts of application with a custom content just for one variant.

I already read this post, It says that you can define different pre-processor macros to use it in your code, but I can't change the application id or app icon for example:
http://forums.xamarin.com/discussion/10834/multi-target

There are something similar to Multi Flavors(Android)/Target(iOS) in Xamarin?

Thanks in advance.

Answers

  • fernandopfernandop USMember ✭✭

    Hi, did you find how to solve this? thanks.

  • JessCrdabaJessCrdaba ESMember ✭✭

    Hi,
    I am waiting for response yet!

    I tried a lot things, but without success. Finally I made 2 different projects, each one for each solution, but I am interesting yet in some solution like MultiFlavors/Targets for Xamarin.

  • I also need this for my project. This will save a lot of time as opposed to duplicating projects.

  • JessCrdabaJessCrdaba ESMember ✭✭

    Hi,
    I did another try to get "multibuilds" in Xamarin and I had some success.

    I have created a new project for Android and iOS with a shared library. To do that I used:
    - Multiple configurations (DebugBuildA, DebugBuildB)
    - Define precompile symbols (IS_A, IS_B)
    - Custom commands (using bash in a Mac) before build to copy files, like "AndroidManifest.xml", "Info.list" and resources, which cannot be replaces with precompile symbols.

    With this I generated multiple application versions, keeping share code in the project (and customize it with precompile symbols) and copying specific files for each build before compile.

    This worked in Android versions and iOS using a real iPhone, however didn't work with an iPhone emulator (It thrown me strange errors). To do this works I cleaned project after switch between builds.

    Sorry for not explain it more (and better), I attach the example project that I made. I hope that this can help you.

  • @Jesus Cardaba .. That is a lot of work ...
    I hope Xamarin adds multi-flavor support, I'm going to need it in the next 4 months .. :neutral:

  • magezmagez VNMember

    a year passed away. Is there anything news from Xamarin? As I can't find official support to build multiple flavors/targets in Xamarin

  • kalyanandroidkalyanandroid USMember

    @XamarinTeam: Any update regarding build flavors.Two years passed.

  • KorayemKorayem EGMember ✭✭

    @JessCrdaba said:
    Hi,
    I did another try to get "multibuilds" in Xamarin and I had some success.

    I have created a new project for Android and iOS with a shared library. To do that I used:
    - Multiple configurations (DebugBuildA, DebugBuildB)
    - Define precompile symbols (IS_A, IS_B)
    - Custom commands (using bash in a Mac) before build to copy files, like "AndroidManifest.xml", "Info.list" and resources, which cannot be replaces with precompile symbols.

    With this I generated multiple application versions, keeping share code in the project (and customize it with precompile symbols) and copying specific files for each build before compile.

    This worked in Android versions and iOS using a real iPhone, however didn't work with an iPhone emulator (It thrown me strange errors). To do this works I cleaned project after switch between builds.

    Sorry for not explain it more (and better), I attach the example project that I made. I hope that this can help you.

    How about a github project so the community can further maintain this solution?

  • JorisWeimarJorisWeimar USMember

    I'm also interested in this. Is there something to do this in a nice way? If not, I'll start a GitHub project.

  • Any news on this question? I need to create a multi-platform xamarin project with multi-flavor. Please if anyone has any information about this, aswer mi comment. Jess's solution in my case could not apply.

Sign In or Register to comment.