In the initial post, we saw a basic overview of developing Android Apps using Xamarin, Visual Studio and C#. While, in the last post, we created a sample HelloWorld Android App and then ran it using Android Emulator. In this post, we’ll start developing an actual Android App using Xamarin and Visual Studio. This App will be called MyBookStore, which will show categories of books, list of books under each category, and will allow users to purchase the books using their Android device. It will be a fully functioning Android app. As there is a lot to cover in this area, so it will span across multiple posts. I’ll explain everything step by step and at the end of this series you’ll be able to build Android Apps using your current .NET, Visual Studio, and C# skills. So let’s get started with setting up our solution and project structure.
Create Blank Solution using Visual Studio
As the first step, we’ll create a blank Visual Studio solution and name it MyBookStore.
Add Blank Android App Project
Right click on your solution in the Visual Studio solution explore and add a blank Android app project in the solution. You can also add a new project using “File -> New Project” option and selecting Android as a template category.
Add Portable Class Library (PCL) Project
In this step, you’ll add a portable class library project in your solution. This library will contain some common code which can be shared across multiple projects like Android, iOS, and Windows Mobile. Do not worry about other options for now as we’re only focusing on Android and later on I’ll explain in detail how to use a PCL in multiple projects.
When you add a Portable Class Library (PCL) project in your solution, it will ask you to select the platforms which you want to support with this library. You can select the platforms as selected in the following image.
Add Folders to Organize Code in Shared Library
Your Portable Class Library is a shared library project, which can be shared and used with multiple projects for multiple platforms. We’ll add many different classes in this project, so it is better to organize all that code in folders to make it more manageable.
Final Look of Solution, Projects, and Folder Strucutre
Once you have completed all the above steps as shared successfully, you’ll see a structure of the solution, projects, and folders as shown in the below screenshot. This will be our starting point for this project. We’ll later on add code, classes, and other artifacts in this solution and these projects to build our Xamarin Android App with Visual Studio and C#.
I hope you were successful in creating this solution and enjoyed this post as well. 🙂 If you find difficulty with any of the above steps, you can freely add your comment below and I’ll answer your questions.