1

i am a beginner xamarin.forms developer and i have developed some free application with google maps for my town.

The application works perfectly on all Visual Studio's (2019) android emulators and even on my old phone (android 4.3).

Publication of the application also was successful.

However the first user who installed the application on his phone (android 9) reported me that the application is crashed. Just crashed at moment of displaying (trying) of map without any error message. But any others (without map) "ContentPage" of the application work as it should. Crash happened only when user tries open ContentPage with the map control.

Because i haven't the real android 9 device (and on all visual studio's android emulators the application is works), i installed the Nox Player:
https://www.bignox.com/
and created 2 available emulators: android 5.1.1 and android 7.1.2
Results: the application successful works on android 5 and crashed on android 7 (together with the android 7 emulator - the emulator program just close without any error message).

Ok. I have created a simplest test xamarin forms map application - just show map and nothing more.

MainPage.xaml:

<ContentPage.Content>
    <map:Map />
</ContentPage.Content>

The same story: works on all visual studio's android emulators, works an my old android 4.3 device, works on nox-player android 5 and crashed on nox android 7!

Then, i tried just to compile a samples from microsoft documentation. For example:
https://learn.microsoft.com/en-us/samples/browse/?products=xamarin&term=Xamarin.Forms.Maps
All these samples are placed here:
https://github.com/xamarin/xamarin-forms-samples/tree/master/WorkingWithMaps
I just downloaded the solution, substitute my "com.google.android.maps.v2.API_KEY" to AndroidManifest.xml and compiled it. No more actions.
Results: The absolutely same behavior.

To be more precise, initially I used the Xamarin.Forms.GoogleMaps package: https://github.com/amay077/Xamarin.Forms.GoogleMaps
with same results.

More over on this page there is the link on already compiled apk with samples: https://install.appcenter.ms/users/okuokuoku/apps/xfgooglemapsample/distribution_groups/trial
Result: the same.

Please, who knows what the reason is?

More info: Android app options pg1 Android app options pg2 Android app options pg3

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.comscreen.App1" android:installLocation="internalOnly">
    <uses-sdk android:minSdkVersion="22" android:targetSdkVersion="28" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:label="App1.Android" android:usesCleartextTraffic="true" android:icon="@mipmap/launcher_foreground">
        <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="MY_API_KEY_SORRY_FOR_HIDING" />
    </application>
</manifest>
Lealan
  • 136
  • 1
  • 1
  • 8
  • What's the exception causing the crash? Have you tried to catch it, or looked in the device logs for information related to the crash? – Jason Oct 19 '19 at 15:50
  • Jason, thank you for answer! Unfortunately i haven't any android 7 or 9 real device. I can reproduce this crash only on the android 7 Nox Player emulator (on all visual studio's android emulators the application works fine). So i cannot catch this crash/exception. When the application crashed on the android 7 nox-emulator, the emulator program also crashed and just closed without any error message. – Lealan Oct 19 '19 at 16:06
  • try installing a crash reporting tool like appcenter.ms to see if it can capture any useful info for you – Jason Oct 19 '19 at 16:12

1 Answers1

0

As you've not provided any erorr code, i can only suspect 2 reasons:

  1. Maybe map requires some kind of permission in new versions of android ? Check again
  2. While creating APK, have you checked all architectures ? Under Android Options -> Advanced -> Supported Architectures -> Select all architectures. More info here: https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/cpu-architectures?tabs=windows
bhavya joshi
  • 1,096
  • 10
  • 20
  • Bhavya Joshi, thank you for answer! The difficulty with this question is precisely that there are no any error messages. As i wrote, the Nox Player emulator with android 7 (the only this available to me instead of a real device) crashed (together with the application) and just closed with silence without any error message. – Lealan Oct 20 '19 at 07:48
  • And, yes, before publication of my question, i also had suggestion that new versions of android needs in some additional permissions. i even created version of my simple application with ALL permissions :) Unfortunately this version works only on VS emulators - but on Nox emulators it crashed. To confirm (or reject) this suggestion - need to iterate over different variants of permissions combinations. It's bored routine (without guarantee of positive results) and i hoped that there is ready answer. – Lealan Oct 20 '19 at 07:49
  • Really, why nobody was interested - why the samples (already compiled as apk) do not work on android 7+? Any can install the demo app and check: https://github.com/amay077/Xamarin.Forms.GoogleMaps – Lealan Oct 20 '19 at 07:58
  • direct link on the googlemaps demo app: https://install.appcenter.ms/users/okuokuoku/apps/xfgooglemapsample/distribution_groups/trial – Lealan Oct 20 '19 at 08:00
  • I've installed your app in Android 9.0 and it is working great.So, there must be an issue with certain devices only. Once again, have you selected all the architectures before creating APK in xamarin? – bhavya joshi Oct 20 '19 at 10:24
  • Bhavya Joshi, thank you much! And thank you for advice! Possible a reason not in android version (however behavior of the application on user's android 9 and nox-android 7+ is identical). I checked "Advanced" options (in basic - "Any CPU" for the all configurations) - was not selected only "x86" and "x86_64" (such by default options). See: https://drive.google.com/open?id=18gmthedCVv213Yra2mFz7M9jZzPjsNv- – Lealan Oct 22 '19 at 17:37
  • I selected all and create the new apks, see: https://drive.google.com/open?id=1BzxUmphysC-lclZid9sXyVCUKSwxdV3r Unfortunately all these apks still crashes on nox-android 7+ with the same behavior. – Lealan Oct 22 '19 at 17:38
  • Then i have installed another android emulator namely the BlueStacks App Player. And it's turned out that on android 7 and on android 8 on this emulator all works (demoApp, my testApp and even my original application). Possible my question is not question about versions. It's seem need access to the real android 9 device where the crash is hapend. – Lealan Oct 22 '19 at 17:39
  • yes, you need to find a debuggable device.otherwise,you will just waste your time . – bhavya joshi Oct 23 '19 at 09:06