Posts Tagged Android

Working with Xamarin Android Player from command line

It is possible to start appropriate Android VM in Xamarin Android Player using the following command in command line on Mac

/Applications/Xamarin Android Player.app/Contents/Helpers/Xamarin Android Player.app/Contents/MacOS/Xamarin Android Player --name "Nexus 5 (Lollipop) NEW"

You can pick the information how to start it from command line using the following command (start VM first using usual way, from Xamarin Android Player):

ps -f -x | grep Xamarin

, , ,

Leave a comment

How to solve the issues when building Xamarin solution for Android on Mac

If you are working with Xamarin Studio then you surely had issues building the solution for Android sometimes,  this post and this post can be useful to help solving that issues.

If these advices didn’t help to you and you still failing to build your solution then try to perform some more steps to clear Xamarin caches before applying the changes in the posts mentioned above:

  1. Clean the solution in Xamarin and leave it
  2. Delete all the ‘bin’ & ‘obj’ folders together with their content from your projects
  3. Delete all the content from the folder “~/local/share/Xamarin”

Enjoy

, , ,

Leave a comment

Reference ‘Xamarin.Android.Support.v4’ not resolved

I killed some days to get rid from the error in the topic, it happened when I tried to compile the app for Android, finally I found a way how to solve it, quick manual:

  1. Select Build -> Clean All in your Xamarin project where you have the issue
  2. Close your Xamarin project
  3. Exit from Xamarin Studio
  4. Go to your project in the file system, find the the folder “packages” delete the folder “Xamarin.Android.Support.v4.*” from there and everything what is inside
  5. Go to your Android project, find there the file “package.config”
  6. Find the line where “Xamarin.Android.Support.v4.*” is mentioned and delete this line
  7. Start Xamarin Studio, load your project
  8. Go to Android part of the project, right click on the “Packages” folder and select menu item “Add packages..”
  9. Find in the repository the package “Xamarin.Android.Support.v4” and install it again
  10. Try to build Android project again
  11. Enjoy, now everything should work again.

, , , ,

1 Comment

Detect in Xamarin.Forms if the app is running in simulator or on real device

Sometimes you need to detect if you are using simulator (emulator) or real device, typical example can be the situation when you are running the webservices used by your application on the same computer where you are running simulator and you would like quickly check how it is working altogether.

There are separate solutions for iOS here:
https://developer.xamarin.com/recipes/ios/general/projects/environment_checks
And for Android here:
http://forums.xamarin.com/discussion/34275/detect-if-simulator-or-device

I just gathered them altogether and created dependency service for Xamarin.Forms application

Read the rest of this entry »

, , , , ,

1 Comment

Creating cross-platform mobile map application with Xamarin in 10 minutes

Quick tutorial: how to create mobile app with maps using Xamarin just in 10 minutes.

Prerequisites

  • Mac computer with installed XCode and Xamarin Studio
  • Subscription to any Xamarin plan starting from Indie and above
  • Basic C# skills

1. Start new solution in Xamarin Studio, select Cross-platform App -> Blank Xamarin.Forms.App

screen01

2. Call the project MapDemo (or any other name you like), check both Android & iOS platforms and use Portable Class Library

Screen Shot 2015-08-19 at 23.53.08

Read the rest of this entry »

, , , , ,

Leave a comment

Compile Xamarin App for Android in release mode

I encountered multiple times the issue when the build of Xamarin app for Android simply didn’t work in release mode without any obvious reason. Finally looks like I got what should be the appropriate configuration.

So, make sure that you have “Options” for Android project as described below:

1. Build -> General

screen01

2. Build -> Android Build -> Linker -> Linker Options

screen02

3. Build -> Android Application (Minimum: 15+; Target: 21+)

screen03

Pay attention to the fact that “Target Framework” in the item 1 should be the same as “Target Android version” in the item 3, you can find the table with appropriate relations between Android name and APIs here: https://source.android.com/source/build-numbers.html

, , ,

1 Comment