How to set up a map in xamarin.forms pcl project?

I created one project with xamarin.form PCL.

I added.....

xamarin.forms.maps and another NuGet library and package have been added in accordance with the requirements on all platforms (Android, iOS, Window Phone).

I gave all permissions and settings on all platforms.

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

Error

Severity Code Description Project file line string 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 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ Android.Support.v4 \ 23.0.1.3 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ Android.Support.v4 \ 23.0.1.3 \ nested \ Libs \ internal_impl-23.0.1.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ Android.Support.v7.AppCompat \ 23.0.1.3 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ Android.Support.v7.CardView \ 23.0.1.3 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ Android.Support.v7.MediaRouter \ 23.0.1.3 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ Android.Support.v7.MediaRouter \ 23.0.1.3 \ nested \ Libs \ internal_impl-23.0.1.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ Android. Support.v7.RecyclerView \ 23.0.1.3 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Ads \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Analytics \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.AppIndexing \ 26.0.0 \ nested \ classes .jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.AppInvite \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.AppState \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Base \ 26.0 .0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Cast \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Drive \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Fitness \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Games \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Gcm \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Identity \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices. Location \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Maps \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Nearby \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppDat a \ Local \ Xamarin \ GooglePlayServices.Panorama \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Plus \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.SafetyNet \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Vision \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Wallet \ 26.0.0 \ nested \ classes.jar "" C: \ Users \ PB DEV \ AppData \ Local \ Xamarin \ GooglePlayServices.Wearable \ 26.0.0 \ embedded \ classes.jar "'SimplyFood.Droid

After updating all nuget packages, I got the error below ...

Unpacking failed. Download https://dl-ssl.google.com/android/repository/google_m2repository_r15.zip and extract it to D: \ Project \ TestApp \ packages \ Xamarin.GooglePlayServices.22.0.0.0 \ Lib \ MonoAndroid41 \ 22.0.0 \ Content catalog. TestApp.Droid

Unpacking failed. Download https://dl-ssl.google.com/android/repository/google_m2repository_r15.zip and extract it to D: \ Project \ TestApp \ packages \ Xamarin.GooglePlayServices.22.0.0.0 \ Lib \ MonoAndroid41 \ 22.0.0 \ Content catalog.

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

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

Error Please install the package: "Google Play Services" is available in the Installer SDK. Java D library file: \ Project \ TestApp \ packages \ Xamarin.GooglePlayServices.22.0.0.0 \ Lib \ MonoAndroid41 \ 22.0.0 \ built-in \ classes.jar does not exist. TestApp.Droid

Error Please install the package: "Google Play Services" is available in the Installer SDK. Android D resource directory: \ Project \ TestApp \ packages \ Xamarin.GooglePlayServices.22.0.0.0 \ Lib \ MonoAndroid41 \ 22.0.0 \ embedded./ does not exist. TestApp.Droid

Is there any other way that makes it easy to integrate the card into an Android phone, iPhone and Window using xamarin?

+5
source share
2 answers

If you are using Visual Studio,

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

If you are using Xamarin Studio, it should be something similar.

It is associated with all loadable Java bindings and loads up to a large amount of memory. With this setting, you increase the available memory by default.

You can learn more about this in the corresponding error in Xamarin some time ago; https://bugzilla.xamarin.com/show_bug.cgi?id=8137#c14

+9
source

There are two possible reasons.

  • Your emulator has very low memory, you can increase it
  • Large images may appear on Android. Android doesnโ€™t work well with images, make sure you compress them to the right size.

With new error messages, go to the problems directory and delete all files and zip contents. VS or Xamarin will load them automatically again.

Also upgrade your compilation API target to API 23, you can keep at least 15 though.

+1
source

Source: https://habr.com/ru/post/1237308/


All Articles