5
votes

I have created one project with xamarin.form PCL.

I have added .....

xamarin.forms.maps and other library and NuGet Package added according to requirement in all platform (Android, iOS, Window Phone).

I have given all permission and configuration in all platform.

I have successfully show map and run program in window phone but i have an error in android.

Error is

Severity Code Description Project File Line Column Error java.lang.OutOfMemoryError. Consider increasing the value of $(JavaMaximumHeapSize). Java ran out of memory while executing 'java.exe -jar "C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.2\lib\dx.jar" --no-strict --dex --output=obj\Debug\android\bin obj\Debug\android\bin\classes "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\mono.android.jar" D:\Project\SimplyFood\SimplyFood\SimplyFood.Droid\obj\Debug__library_projects__\FormsViewGroup\library_project_imports\formsviewgroup.jar "C:\Users\PB DEV\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\Android.Support.v4\23.0.1.3\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\Android.Support.v4\23.0.1.3\embedded\libs\internal_impl-23.0.1.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\Android.Support.v7.AppCompat\23.0.1.3\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\Android.Support.v7.CardView\23.0.1.3\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\Android.Support.v7.MediaRouter\23.0.1.3\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\Android.Support.v7.MediaRouter\23.0.1.3\embedded\libs\internal_impl-23.0.1.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\Android.Support.v7.RecyclerView\23.0.1.3\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Ads\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Analytics\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.AppIndexing\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.AppInvite\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.AppState\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Base\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Cast\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Drive\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Fitness\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Games\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Gcm\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Identity\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Location\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Maps\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Nearby\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Panorama\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Plus\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.SafetyNet\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Vision\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Wallet\26.0.0\embedded\classes.jar" "C:\Users\PB DEV\AppData\Local\Xamarin\GooglePlayServices.Wearable\26.0.0\embedded\classes.jar"' SimplyFood.Droid

After update all nuget packages i got below error...

Unzipping failed. Please download https://dl-ssl.google.com/android/repository/google_m2repository_r15.zip and extract it to the D:\Project\TestApp\packages\Xamarin.GooglePlayServices.22.0.0.0\lib\MonoAndroid41\22.0.0\content directory. TestApp.Droid

Unzipping failed. Please download https://dl-ssl.google.com/android/repository/google_m2repository_r15.zip and extract it to the D:\Project\TestApp\packages\Xamarin.GooglePlayServices.22.0.0.0\lib\MonoAndroid41\22.0.0\content directory.

Error Reason: D:\Project\TestApp\packages\Xamarin.GooglePlayServices.22.0.0.0\lib\MonoAndroid41\22.0.0\742021DEBBD30AFFB5B67FB39AB43D94.zip is not a valid zip file TestApp.Droid

Error Reason: D:\Project\TestApp\packages\Xamarin.GooglePlayServices.22.0.0.0\lib\MonoAndroid41\22.0.0\742021DEBBD30AFFB5B67FB39AB43D94.zip is not a valid zip file TestApp.Droid

Error Please install package: 'Google Play Services' available in SDK installer. Java library file D:\Project\TestApp\packages\Xamarin.GooglePlayServices.22.0.0.0\lib\MonoAndroid41\22.0.0\embedded\classes.jar doesn't exist. TestApp.Droid

Error Please install package: 'Google Play Services' available in SDK installer. Android resource directory D:\Project\TestApp\packages\Xamarin.GooglePlayServices.22.0.0.0\lib\MonoAndroid41\22.0.0\embedded./ doesn't exist. TestApp.Droid

Is there any other way available to integrate map easily in android, iPhone and Window phone using xamarin ?

2

2 Answers

9
votes

If you're using Visual Studio;

Right-click your Droid project, go to the Android Options tab, click Advanced and set Java Max Heap Size to 1G

If you're using Xamarin Studio it should be something similar.

It has to do with all the Java bindings that are being loaded and it loads up to much memory. With this setting you increase the default memory available.

You can read more about it in the relevant bug in Xamarin from a while back here; https://bugzilla.xamarin.com/show_bug.cgi?id=8137#c14

1
votes

There are 2 possible causes.

  1. Your emulator has very low memory, you can increase that
  2. You may have some large images showing on Android. Android doesn't do well with images, make sure you shrink them to the correct size.

With your new error messages, go to the directory with the issues and delete all the zip files and contents. VS or Xamarin will download them automatically again.

Also update your compile API target to API 23, you can keep the minimum at 15 though.