Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Device does not have package com.google.android.gsf (Visual Studio Android Emulator)

I am developing Xamarin Cross platform application in which I am using Google Cloud Messaging service. So when I call below method, I get exception "Device does not have package com.google.android.gsf". I trying to run this project on Visual Studio Android Emulator (MarshMallow Android 6.0 -API 23) and (Lollipop Android 5.1 - API 22)

So how to overcome this problem. Thanks in advance.

      try {
            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);

            // Register for push notifications
            Log.Info("MainActivity", "Registering...");
            GcmClient.Register(this, Constants.SenderID);
        }
        catch(Exception ex)
        {

        }
like image 878
Parth Savadiya Avatar asked Apr 28 '16 07:04

Parth Savadiya


1 Answers

Visual Studio Emulators do not have it installed by default. Hence you need to install the Gapps CyanogenMod, which contains the Google Apps needed to run things such as Push Notifications.

  1. Download Gapps CyanogenMod for your emulator version. (For the visual studio emulators you want to pick the HDPI / MDPI / TINY version).

  2. Once downloaded make sure you have your emulator loaded. Drag and drop the zip file into the emulator. You will be prompted to install.

enter image description here

  1. Press Install and Shutdown. It will then copy, extract and install the services.

enter image description here

  1. Then start up your Visual Studio Emulator again. This might mean running your project again. However because it needs to configure a few things on boot your app might not start on the first emulator load. You may need to run your VS project again to run.

enter image description here

Now you will no longer get the Device does not have package com.google.android.gsf error.

like image 161
Adam Avatar answered Sep 27 '22 23:09

Adam