Xamarin.Android application crashes only on release

Adrien COURNAND 141 Reputation points
2022-03-01T15:19:01.647+00:00

I am developing an application for ios and Android but I have a strange problem for Android: with the same parameters for the project, my application runs in debug mode but crashes in release.

For debug and release I have the same parameters :

  • no linker
  • no shrinker
  • dex enable with the d8 compiler.

I tested to build on visual studio for mac and window and I have the same problem. On both sides I use Xamarin.Essentials 1.7.1 and Xamarin.Forms 5.0.0.2337.

I tried to compile and install the application for two android devices (the two I have in my possession: one with Android 6.0 and one with android 4.4) on Debug and Release mode. I always clean the solution and remove all the obj and bin folders before building.

On visual studio on windows (2022), when I open the device log I can see two errors :

Time    Device Name Type    PID Tag Message
03-01 09:40:41.144  Samsung SM-G900F    Error   29511   AndroidRuntime  android.runtime.JavaProxyThrowable: Xamarin.Forms.Xaml.XamlParseException: Position 20:104. Input string was not in a correct format. ---> System.FormatException: Input string was not in a correct format.
  at System.Number.ThrowOverflowOrFormatException (System.Boolean overflow, System.String overflowResourceKey) [0x0001a] in <a8b4702b60024176b74a9d7a0c8fe330>:0 
  at System.Number.ParseDouble (System.ReadOnlySpan`1[T] value, System.Globalization.NumberStyles styles, System.Globalization.NumberFormatInfo info) [0x0007d] in <a8b4702b60024176b74a9d7a0c8fe330>:0 
  at System.Double.Parse (System.String s, System.IFormatProvider provider) [0x0001b] in <a8b4702b60024176b74a9d7a0c8fe330>:0 
  at Xamarin.Forms.Xaml.TypeConversionExtensions.ConvertTo (System.Object value, System.Type toType, System.Func`1[TResult] getConverter, System.IServiceProvider serviceProvider, System.Exception& exception) [0x00311] in <942f50a2f8f34eb98b8b2ca60dd3cb90>:0 
   --- End of inner exception stack trace ---
  at Xamarin.Forms.Xaml.ValueConverterProvider.Convert (System.Object value, System.Type toType, System.Func`1[TResult] minfoRetriever, System.IServiceProvider serviceProvider) [0x00046] in <942f50a2f8f34eb98b8b2ca60dd3cb90>:0 
  at Xamarin.Forms.Xaml.OnPlatformExtension.ProvideValue (System.IServiceProvider serviceProvider) [0x0019d] in <e751a0da99d348a89c7cac1ab7035b2d>:0 
  at PianoTraining.WelcomeModalPage.InitializeComponent () [0x00503] in <52f27fd8098b409fba84c26a409ec7c4>:0 
  at PianoTraining.WelcomeModalPage..ctor (PianoTraining.LevelSelectionPage levelSelectionPage) [0x00006] in <52f27fd8098b409fba84c26a409ec7c4>:0 
  at PianoTraining.LevelSelectionPage.OnAppearing () [0x00017] in <52f27fd8098b409fba84c26a409ec7c4>:0 
  at Xamarin.Forms.Page.SendAppearing () [0x00045] in <942f50a2f8f34eb98b8b2ca60dd3cb90>:0 
  at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.SendLifecycleEvent (System.Boolean isAppearing) [0x00059] in <5e1b8d459de74e57b45e08e71800961d>:0 
  at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnResume () [0x00018] in <5e1b8d459de74e57b45e08e71800961d>:0 
  at AndroidX.Fragment.App.Fragment.n_OnResume (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <60d1ff53f45444a389466d2381f9db46>:0 
  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.55(intptr,intptr)
    at crc64720bb2db43a66fe9.FragmentContainer.n_onResume(Native Method)
    at crc64720bb2db43a66fe9.FragmentContainer.onResume(FragmentContainer.java:73)
    at androidx.fragment.app.Fragment.performResume(Fragment.java:3039)
    at androidx.fragment.app.FragmentStateManager.resume(FragmentStateManager.java:607)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:306)
    at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
    at androidx.fragment.app.FragmentManager.dispatchResume(FragmentManager.java:3086)
    at androidx.fragment.app.FragmentController.dispatchResume(FragmentController.java:273)
    at androidx.fragment.app.FragmentActivity.onResumeFragments(FragmentActivity.java:458)
    at androidx.fragment.app.FragmentActivity.onPostResume(FragmentActivity.java:447)
    at androidx.appcompat.app.AppCompatActivity.onPostResume(AppCompatActivity.java:240)
    at android.app.Activity.performResume(Activity.java:7016)
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4144)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4245)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3360)
    at android.app.ActivityThread.access$1100(ActivityThread.java:221)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:158)
    at
  Force finishing activity fr.adriencournand.pianotraining/crc6473da61b4fd8aabab.MainActivity

and

Time    Device Name Type    PID Tag Message
03-01 09:40:41.144  Samsung SM-G900F    Info    29511   MonoDroid   android.runtime.JavaProxyThrowable: Xamarin.Forms.Xaml.XamlParseException: Position 20:104. Input string was not in a correct format. ---> System.FormatException: Input string was not in a correct format.
  at System.Number.ThrowOverflowOrFormatException (System.Boolean overflow, System.String overflowResourceKey) [0x0001a] in <a8b4702b60024176b74a9d7a0c8fe330>:0 
  at System.Number.ParseDouble (System.ReadOnlySpan`1[T] value, System.Globalization.NumberStyles styles, System.Globalization.NumberFormatInfo info) [0x0007d] in <a8b4702b60024176b74a9d7a0c8fe330>:0 
  at System.Double.Parse (System.String s, System.IFormatProvider provider) [0x0001b] in <a8b4702b60024176b74a9d7a0c8fe330>:0 
  at Xamarin.Forms.Xaml.TypeConversionExtensions.ConvertTo (System.Object value, System.Type toType, System.Func`1[TResult] getConverter, System.IServiceProvider serviceProvider, System.Exception& exception) [0x00311] in <942f50a2f8f34eb98b8b2ca60dd3cb90>:0 
   --- End of inner exception stack trace ---
  at Xamarin.Forms.Xaml.ValueConverterProvider.Convert (System.Object value, System.Type toType, System.Func`1[TResult] minfoRetriever, System.IServiceProvider serviceProvider) [0x00046] in <942f50a2f8f34eb98b8b2ca60dd3cb90>:0 
  at Xamarin.Forms.Xaml.OnPlatformExtension.ProvideValue (System.IServiceProvider serviceProvider) [0x0019d] in <e751a0da99d348a89c7cac1ab7035b2d>:0 
  at PianoTraining.WelcomeModalPage.InitializeComponent () [0x00503] in <52f27fd8098b409fba84c26a409ec7c4>:0 
  at PianoTraining.WelcomeModalPage..ctor (PianoTraining.LevelSelectionPage levelSelectionPage) [0x00006] in <52f27fd8098b409fba84c26a409ec7c4>:0 
  at PianoTraining.LevelSelectionPage.OnAppearing () [0x00017] in <52f27fd8098b409fba84c26a409ec7c4>:0 
  at Xamarin.Forms.Page.SendAppearing () [0x00045] in <942f50a2f8f34eb98b8b2ca60dd3cb90>:0 
  at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.SendLifecycleEvent (System.Boolean isAppearing) [0x00059] in <5e1b8d459de74e57b45e08e71800961d>:0 
  at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnResume () [0x00018] in <5e1b8d459de74e57b45e08e71800961d>:0 
  at AndroidX.Fragment.App.Fragment.n_OnResume (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <60d1ff53f45444a389466d2381f9db46>:0 
  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.55(intptr,intptr)
    at crc64720bb2db43a66fe9.FragmentContainer.n_onResume(Native Method)
    at crc64720bb2db43a66fe9.FragmentContainer.onResume(FragmentContainer.java:73)
    at androidx.fragment.app.Fragment.performResume(Fragment.java:3039)
    at androidx.fragment.app.FragmentStateManager.resume(FragmentStateManager.java:607)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:306)
    at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
    at androidx.fragment.app.FragmentManager.dispatchResume(FragmentManager.java:3086)
    at androidx.fragment.app.FragmentController.dispatchResume(FragmentController.java:273)
    at androidx.fragment.app.FragmentActivity.onResumeFragments(FragmentActivity.java:458)
    at androidx.fragment.app.FragmentActivity.onPostResume(FragmentActivity.java:447)
    at androidx.appcompat.app.AppCompatActivity.onPostResume(AppCompatActivity.java:240)
    at android.app.Activity.performResume(Activity.java:7016)
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4144)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4245)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3360)
    at android.app.ActivityThread.access$1100(ActivityThread.java:221)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:158)
    at android.app.ActivityThread.main(ActivityThread.java:7224)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

And a lot of other of this form :

.Time   Device Name Type    PID Tag Message
03-01 09:40:40.874  Samsung SM-G900F    Warning 29511   ResourceType    For resource 0x7f0f0244, entry index(580) is beyond type entryCount(180)

On visual studio for mac (2019 v 8.10.19):

I have this error for both phones in Release (and the application works fine in Debug):

[dalvikvm] VFY: replacing opcode 0x70 at 0x000003-01 15:04:07.071 D/AndroidRuntime( 8098): Shutting down VM
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Android.Runtime.JavaProxyThrowable: Exception of type 'Android.Runtime.JavaProxyThrowable' was thrown.
[MonoDroid] Android.Runtime.JavaProxyThrowable: Exception of type 'Android.Runtime.JavaProxyThrowable' was thrown.03-01 15:04:07.101 I/MonoDroid( 8098):   --- End of managed Android.Runtime.JavaProxyThrowable stack trace ---
[MonoDroid] android.runtime.JavaProxyThrowable: Xamarin.Forms.Xaml.XamlParseException: Position 20:104. Input string was not in a correct format. ---> System.FormatException: Input string was not in a correct format.
[MonoDroid]   at System.Number.ThrowOverflowOrFormatException (System.Boolean overflow, System.String overflowResourceKey) [0x0001a] in <1b39a03c32ec46258a7821e202e0269f>:0 
[MonoDroid]   at System.Number.ParseDouble (System.ReadOnlySpan`1[T] value, System.Globalization.NumberStyles styles, System.Globalization.NumberFormatInfo info) [0x0007d] in <1b39a03c32ec46258a7821e202e0269f>:0 
[MonoDroid]   at System.Double.Parse (System.String s, System.IFormatProvider provider) [0x0001b] in <1b39a03c32ec46258a7821e202e0269f>:0 
[MonoDroid]   at Xamarin.Forms.Xaml.TypeConversionExtensions.ConvertTo (System.Object value, System.Type toType, System.Func`1[TResult] getConverter, System.IServiceProvider serviceProvider, System.Exception& exception) [0x00311] in <942f50a2f8f34eb98b8b2ca60dd3cb90>:0 
[MonoDroid]   at System.Double.Parse (System.String s, System.IFormatProvider provider) [0x0001b] in <1b39a03c32ec46258a7821e202e0269f>:0 03-01 15:04:07.101 I/MonoDroid( 8098):    --- End of inner exception stack trace ---
[MonoDroid]   at Xamarin.Forms.Xaml.ValueConverterProvider.Convert (System.Object value, System.Type toType, System.Func`1[TResult] minfoRetriever, System.IServiceProvider serviceProvider) [0x00046] in <942f50a2f8f34eb98b8b2ca60dd3cb90>:0 
[MonoDroid]   at Xamarin.Forms.Xaml.OnPlatformExtension.ProvideValue (System.IServiceProvider serviceProvider) [0x0019d] in <e751a0da99d348a89c7cac1ab7035b2d>:0 
[MonoDroid]   at PianoTraining.WelcomeModalPage.InitializeComponent () [0x00503] in <2c3ed1d8e6d44744941cb5991ff2104c>:0 
[MonoDroid]   at PianoTraining.WelcomeModalPage..ctor (PianoTraining.LevelSelectionPage levelSelectionPage) [0x00006] in <2c3ed1d8e6d44744941cb5991ff2104c>:0 
[MonoDroid]   at PianoTraining.LevelSelectionPage.OnAppearing () [0x00017] in <2c3ed1d8e6d44744941cb5991ff2104c>:0 
[MonoDroid]   at Xamarin.Forms.Page.SendAppearing () [0x00045] in <942f50a2f8f34eb98b8b2ca60dd3cb90>:0 
[MonoDroid]   at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.SendLifecycleEvent (System.Boolean isAppearing) [0x00059] in <5e1b8d459de74e57b45e08e71800961d>:0 
[MonoDroid]   at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnResume () [0x00018] in <5e1b8d459de74e57b45e08e71800961d>:0 
[MonoDroid]   at AndroidX.Fragment.App.Fragment.n_OnResume (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <60d1ff53f45444a389466d2381f9db46>:0 
[MonoDroid]   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.40(intptr,intptr)
[MonoDroid]     at crc64720bb2db43a66fe9.FragmentContainer.n_onResume(Native Method)
[MonoDroid]     at crc64720bb2db43a66fe9.FragmentContainer.onResume(FragmentContainer.java:73)
[MonoDroid]     at androidx.fragment.app.Fragment.performResume(Fragment.java:3039)
[MonoDroid]     at androidx.fragment.app.FragmentStateManager.resume(FragmentStateManager.java:607)
[MonoDroid]     at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:306)
[MonoDroid]     at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
[MonoDroid]     at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
[MonoDroid]     at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
[MonoDroid]     at androidx.fragment.app.FragmentManager.dispatchResume(FragmentManager.java:3086)
[MonoDroid]     at androidx.fragment.app.FragmentController.dispatchResume(FragmentController.java:273)
[MonoDroid]   at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.SendLifecycleEvent (System.Boolean isAppearing) [0x00059] in <5e1b8d459de74e57b45e08e71800961d>:0 03-01 15:04:07.101 I/MonoDroid( 8098):  at androidx.fragment.app.FragmentActivity.onResumeFragments(FragmentActivity.java:458)
[MonoDroid]     at androidx.fragment.app.FragmentActivity.onPostResume(FragmentActivity.java:447)
[MonoDroid]     at androidx.appcompat.app.AppCompatActivity.onPostResume(AppCompatActivity.java:240)
[MonoDroid]     at android.app.Activity.performResume(Activity.java:5388)
[MonoDroid]     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2922)
[MonoDroid]     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2961)
[MonoDroid]     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2375)
[MonoDroid]   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.40(intptr,intptr)03-01 15:04:07.111 I/MonoDroid( 8098):  at android.app.ActivityThread.access$800(ActivityThread.java:155)
[MonoDroid]     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)
[MonoDroid]     at android.os.Handler.dispatchMessage(Handler.java:102)
[MonoDroid]     at android.os.Looper.loop(Looper.java:136)
[MonoDroid]     at android.app.ActivityThread.main(ActivityThread.java:5426)
[MonoDroid]     at java.lang.reflect.Method.invokeNative(Native Method)
[MonoDroid]     at java.lang.reflect.Method.invoke(Method.java:515)
[MonoDroid]     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
[MonoDroid]     03-01 15:04:07.111 I/MonoDroid( 8098):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
[MonoDroid]     at dalvik.system.NativeStart.main(Native Method)
[AndroidRuntime] FATAL EXCEPTION: main
[AndroidRuntime] Process: fr.adriencournand.pianotraining, PID: 8098
[AndroidRuntime] android.runtime.JavaProxyThrowable: Xamarin.Forms.Xaml.XamlParseException: Position 20:104. Input string was not in a correct format. ---> System.FormatException: Input string was not in a correct format.
[AndroidRuntime]   at System.Number.ThrowOverflowOrFormatException (System.Boolean overflow, System.String overflowResourceKey) [0x0001a] in <1b39a03c32ec46258a7821e202e0269f>:0 
[AndroidRuntime]   at System.Number.ParseDouble (System.ReadOnlySpan`1[T] value, System.Globalization.NumberStyles styles, System.Globalization.NumberFormatInfo info) [0x0007d] in <1b39a03c32ec46258a7821e202e0269f>:0 
[AndroidRuntime]   at Xamarin.Forms.Xaml.TypeConversionExtensions.ConvertTo (System.Object value, System.Type toType, System.Func`1[TResult] getConverter, System.IServiceProvider serviceProvider, System.Exception& exception) [0x00311] in <942f50a2f8f34eb98b8b2ca60dd3cb90>:0 
[AndroidRuntime]    --- End of inner exception stack trace ---
[AndroidRuntime]   at Xamarin.Forms.Xaml.ValueConverterProvider.Convert (System.Object value, System.Type toType, System.Func`1[TResult] minfoRetriever, System.IServiceProvider serviceProvider) [0x00046] in <942f50a2f8f34eb98b8b2ca60dd3cb90>:0 
[AndroidRuntime]   at Xamarin.Forms.Xaml.OnPlatformExtension.ProvideValue (System.IServiceProvider serviceProvider) [0x0019d] in <e751a0da99d348a89c7cac1ab7035b2d>:0 
[AndroidRuntime]   at PianoTraining.WelcomeModalPage.InitializeComponent () [0x00503] in <2c3ed1d8e6d44744941cb5991ff2104c>:0 
[AndroidRuntime]   at PianoTraining.WelcomeModalPage..ctor (PianoTraining.LevelSelectionPage levelSelectionPage) [0x00006] in <2c3ed1d8e6d44744941cb5991ff2104c>:0 
[AndroidRuntime]   at PianoTraining.LevelSelectionPage.OnAppearing () [0x00017] in <2c3ed1d8e6d44744941cb5991ff2104c>:0 
[AndroidRuntime]   at Xamarin.Forms.Page.SendAppearing () [0x00045] in <942f50a2f8f34eb98b8b2ca60dd3cb90>:0 
[AndroidRuntime]   at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.SendLifecycleEvent (System.Boolean isAppearing) [0x00059] in <5e1b8d459de74e57b45e08e71800961d>:0 
[AndroidRuntime]   at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnResume () [0x00018] in <5e1b8d459de74e57b45e08e71800961d>:0 
[AndroidRuntime]   at AndroidX.Fragment.App.Fragment.n_OnResume (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <60d1ff53f45444a389466d2381f9db46>:0 
[AndroidRuntime]   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.40(intptr,intptr)
[AndroidRuntime]    at crc64720bb2db43a66fe9.FragmentContainer.n_onResume(Native Method)
[AndroidRuntime]    at crc64720bb2db43a66fe9.FragmentContainer.onResume(FragmentContainer.java:73)
[AndroidRuntime]    at androidx.fragment.app.FragmentStateManager.resume(FragmentStateManager.java:607)
[AndroidRuntime]    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:306)
[AndroidRuntime]    at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
[AndroidRuntime]    at androidx.fragment.app.FragmentSt(FragmentManager.java:1647)
[AndroidRuntime]    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
[AndroidRuntime]    at androidx.fragment.app.FragmentManager.dispatchResume(FragmentManager.java:3086)
[AndroidRuntime]    at androidx.fragment.app.FragmentActivity.onResumeFragments(FragmentActivity.java:458)
[AndroidRuntime]    at androidx.fragment.app.FragmentActivity.onPostResume(FragmentActivity.java:447)
[AndroidRuntime]    at androidx.appcompat.app.AppCompatActivity.onPostResume(AppCompatActivity.java:240)
[AndroidRuntime]    at android.app.Activity.performResume(Activity.java:5388)
[AndroidRuntime]    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2922)
[AndroidRuntime]    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2961)
[AndroidRuntime]    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2375)
[AndroidRuntime]    at android.app.ActivityThread.access$800(ActivityThread.java:155)
[AndroidRuntime]    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)
[AndroidRuntime]    at android.os.Handler.dispatchMessage(Handler.java:102)
[AndroidRuntime]    at android.os.Looper.loop(Looper.java:136)
[AndroidRuntime]    at a
[Process] Sending signal. PID: 8098 SIG: 9
Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,362 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Adrien COURNAND 141 Reputation points
    2022-03-02T09:41:27.72+00:00

    Manifest:

    <?xml version="1.0" encoding="utf-8"?>  
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="7" android:versionName="1.1.0" package="fr.adriencournand.pianotraining" android:installLocation="auto">  
        <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="31" />  
        <uses-permission android:name="android.permission.RECORD_AUDIO" />  
        <uses-permission android:name="android.permission.INTERNET" />  
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />  
        <application android:label="PianoTraining" android:theme="@style/MainTheme" android:icon="@mipmap/icon">  
            <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent" />  
            <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ID copied from google AdMob" />  
        </application>  
    </manifest>  
    

    I precise that the application was working fine before in Debug and Release, I made no changes on the source code

    Also the target framework is set to Android 10.0 (Q) because it is the highest supported by Xamarin.Essentials, but I have the same behaviour when targeting framework 9.0

    Xamarin.Essentials supports a minimum Android version of 4.4, corresponding to API level 19, but the target Android version for compiling must be 9.0 or 10.0, corresponding to API level 28 and level 29. (In Visual Studio, these two versions are set in the Project Properties dialog for the Android project, in the Android Manifest tab. In Visual Studio for Mac, they're set in the Project Options dialog for the Android project, in the Android Application tab.)

    https://learn.microsoft.com/en-us/xamarin/essentials/get-started?tabs=macos%2Candroid#tabpanel_2\_android


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.