locked
App runs in debug mode, crashes in release mode RRS feed

  • Question

  • User4217 posted

    Hi!

    When running my xamarin forms app on android in debug mode, all works fine. But when running it in release mode the app crashes after showing the splash screen. (I have deleted the debug version from phone before installing the release version). Below you can see the application output. If i delete "Mono Android-23 Support" and "Mono shared Runtime" and reinstall the release version my app does NOT crash in release mode. So far okay - but will it work later when somebody installs my app from Play store?

    What are your experiences with debug and release mode?

    Thanks a lot and have a nice day! Andreas

    Application Output: [AndroidRuntime] Shutting down VM [AndroidRuntime] FATAL EXCEPTION: main [AndroidRuntime] Process: Alarm.Droid, PID: 8858 [AndroidRuntime] java.lang.RuntimeException: java.lang.reflect.InvocationTargetException [AndroidRuntime] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811) [AndroidRuntime] Caused by: java.lang.reflect.InvocationTargetException [AndroidRuntime] at java.lang.reflect.Method.invoke(Native Method) [AndroidRuntime] at java.lang.reflect.Method.invoke(Method.java:372) [AndroidRuntime] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1016) [AndroidRuntime] ... 1 more [AndroidRuntime] Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: System.IO.FileNotFoundException: Could not load file or assembly 'alarm' or one of its dependencies. The system cannot find the file specified. [AndroidRuntime] File name: 'alarm' [AndroidRuntime] at System.AppDomain.Load (System.Reflection.AssemblyName,System.Security.Policy.Evidence) <0x003d4> [AndroidRuntime] at System.AppDomain.Load (System.Reflection.AssemblyName) <0x0001f> [AndroidRuntime] at (wrapper remoting-invoke-with-check) System.AppDomain.Load (System.Reflection.AssemblyName) <0x0007b> [AndroidRuntime] at System.Reflection.Assembly.Load (System.Reflection.AssemblyName) <0x0001f> .....

    Thursday, November 12, 2015 5:48 PM

All replies

  • User1175 posted

    Hi @Bytemaniac

    try to add the following line:

    If Visual Studio:

    Visual Studio

    If Xamarin Studio:

    Visual Studio

    More Info

    Cheers!! RIYAZ

    Friday, November 13, 2015 11:46 AM
  • User4217 posted

    Hi!

    I have found another solution - i had to make the PCL-Project assembly name lower case!

    Now the app runs without problem also in release mode (without the linkskip option)!

    Thanks for help!

    Andreas

    Tuesday, November 17, 2015 4:40 PM
  • User4217 posted

    Okay, at another point in my application i get now the message "Coult not load file or assembly 'Alarm'...." With upper case! Seems that i have to include an upper case version and a lower case version of my PCL project assembly.

    Wired!

    Has anybody else such a problem?

    Thanks! Andreas

    Tuesday, November 17, 2015 4:49 PM
  • User144454 posted

    Hey Andreas,

    do you have any solution for this? I have something similiar but maybe quite different. Can't watch the logs at the moment i will check this at evening. Iam using Android app with portable library. In debugmode all is working as expected but in releasemode the app is crashing when access the portable library first time. I try to load some data from REST Service and using async/await and Newton.Json API. I think some of this components are the problem. I have granted Network_Status and Internet Permission.

    If you have some new experiences let me know ;-)

    Tuesday, April 26, 2016 6:33 AM
  • User99156 posted

    @SebastianEling said: Hey Andreas,

    do you have any solution for this? I have something similiar but maybe quite different. Can't watch the logs at the moment i will check this at evening. Iam using Android app with portable library. In debugmode all is working as expected but in releasemode the app is crashing when access the portable library first time. I try to load some data from REST Service and using async/await and Newton.Json API. I think some of this components are the problem. I have granted Network_Status and Internet Permission.

    If you have some new experiences let me know ;-) maybe you need try and catch to catch exceptions. pay attention to NullReferenceException.

    Tuesday, April 26, 2016 9:28 AM
  • User4217 posted

    Hi! The problem was that all assembly names had to be lower case. I had lower/upper case mixed. Don't why it works in debug mode but not in release mode (project options / output / assembly name). Hope it helps! Best regards Andreas

    Tuesday, April 26, 2016 10:46 AM
  • User127535 posted

    In our case, we switched Linking to 'None' in Linker properties to get it work in release mode.

    Monday, July 4, 2016 9:27 AM
  • User136477 posted

    check the internet permission property in Android manifest file.

    Saturday, August 6, 2016 5:55 AM
  • User166981 posted

    @Sivamuralidhar said: check the internet permission property in Android manifest file.

    This solved it for me! Thanks a ton Siva.

    Monday, October 31, 2016 6:45 PM
  • User266789 posted

    I am having the same problem. I added internet permissions and linking to SDk assemblies only. Still not working and no way to tell what causes the crash.

    Friday, November 18, 2016 9:20 PM
  • User280063 posted

    @PonsundarSingh said: In our case, we switched Linking to 'None' in Linker properties to get it work in release mode.

    Thanks! That solved my problem.

    Wednesday, November 30, 2016 8:35 AM
  • User185739 posted

    @PonsundarSingh said: In our case, we switched Linking to 'None' in Linker properties to get it work in release mode.

    Thanks! That solved my problem.

    Saturday, December 31, 2016 9:21 AM
  • User294212 posted

    @Sivamuralidhar said: check the internet permission property in Android manifest file.

    Added to AndroidManifest.xml following line and worked. Thanks Shiva

    Wednesday, January 25, 2017 2:11 PM
  • User292169 posted

    In our case, we switched Linking to 'None' in Linker properties to get it work in release mode. None of the other suggestions worked. Currently using VS 2017 RC Enterprise version released today. I renamed all assemblies to lower case as suggested but that alone didn't get the release build to work. Debug works fine, which is confusing. I've been tweaking the android build properties all day and with this final tweak, I'm able to get it working with "Use shared runtime", "Bundle assemblies into native code" and "Enable ProGuard" all checked. (NOTE: "Use shared runtime" had to be unchecked as apps cannot be archived with this setting checked. Unfortunately, this caused the apk file to balloon from 15mb to 41mb).

    I don't mind having to use a few tricks to get around anomolies given the tremendous benefits xamarin offers. What I do mind is the list constantly changing and expanding. reading the troubleshooting section is a great start to the checklist of things to try. I am surprised Xamarin doesn't offer a consolidated troubleshooting page to save everyone from having to search endlessly for the numerous workarounds.

    https://github.com/NowBI/Xamarin-Forms-Mobile-Template/blob/master/README.md

    You want to see a discussion of xamarin viability I suggest

    https://www.reddit.com/r/dotnet/comments/55cp6a/xamarinthelatestreleaseisunusableandineed/

    and

    http://www.estaun.net/blog/some-thoughts-after-almost-a-year-of-real-xamarin-use/

    The tremendous respect mentioned in these posts for the creators of xamarin is warranted IMHO. It is an unbelievably difficult challenge to do what they are doing. That respect is dimmed by the tremendous waste of time I have experienced accumulating a list of workarounds to environment instability, time that I could have spent coding.

    Sunday, February 26, 2017 6:57 AM
  • User253102 posted

    I'm having this weird issue as well but the other way around.

    The app works in Release, but not in Debug. My original question is in here http://stackoverflow.com/questions/42605200/xamarin-android-immediately-terminates

    Sunday, March 5, 2017 6:49 AM
  • User192564 posted

    @Sivamuralidhar : Internet enable in manifest works.

    Friday, March 17, 2017 11:35 AM
  • User221074 posted

    http://stackoverflow.com/questions/24572052/install-failed-no-matching-abis-when-install-apk

    gothrough this

    Wednesday, March 22, 2017 12:42 PM
  • User298047 posted

    Hello ! I have the same problem, but none of the solutions above worked for me...

    Is there any other option to fix this ? I even implemented HockeyApp in the hope of some metrics, but the app crash even before it register to the service.

    EDIT : Finally I wass able to make it work by unselecting (is that a word ?) the option Bundle Assemblies into native code. I had to try everything to find this. Apparently there is very little documentation about what this option really does, so if somebody would provide a link, that would be great !

    Tuesday, April 18, 2017 1:34 PM
  • User310833 posted

    Just in case the above solutions don't work for someone:

    1. Clean your solution (Debug & Release)
    2. Uninstall the application on your device (or emulator)
    3. Deploy your solution

    These steps (somehow) fixed the crashing for me. No changes were made to anything in my solution- it simply resolved itself after completing the steps above!

    Hope this helps...

    Thursday, April 27, 2017 7:50 PM
  • User282668 posted

    My app is running properly in release mode but getting crashed in Debug mode. Please help. I'm new to this stuff.

    Saturday, May 6, 2017 11:41 AM
  • User126143 posted

    for me using Shared project... the conditional compilation symbol was set for debug mode and not release.

    Saturday, May 13, 2017 6:37 PM
  • User331249 posted

    I was able to solve this issue in VS 2017/Xamarin 4.5.

    Firstly I created a new Platform for x86 within Configuration Manager (Platform > New...). I then changed all build options to reference Release/x86 in the project properties. I also set Linker properties "Linking" to None.

    And lastly, I had to enable x86 within Android Options > Advanced > Supported Architectures. Hope this helps someone...

    Sunday, June 18, 2017 2:30 AM
  • User103821 posted

    @DFoulk said: Just in case the above solutions don't work for someone:

    1. Clean your solution (Debug & Release)
    2. Uninstall the application on your device (or emulator)
    3. Deploy your solution

    For me this worked. I only needed to right-click the solution and choose Clean Solution and everything worked. Didn't even need to uninstall the app first. Must have been some leftovers in the solution/project since my previous updates and upgrades of Xamarin and Visual Studio. Seems like I always run into some kind of problem after installing Xamarin updates so now I don't know if I dare update anything again unless I really have to.

    Tuesday, October 3, 2017 4:05 PM
  • User310833 posted

    @MarcusI - Glad to hear it. Yes, there is something out of alignment between the installation on the device (perhaps left over settings, data in the cache, etc.)- or some code gremlin who wants to ruin our sprints...

    We all run into issues after updating NuGet packages. I have a few tips that may prevent future issues for peeps:

    1) Only upgrade to stable packages 2) Do not upgrade to a newer major version of a package (1.0.0 => 1.0.1 is okay, but not 1.0.0 => 2.0.0) as major versions indicate that backwards incompatible changes are introduced to the public API (usually) 3) Do your best to make sure that your packages are compatible with installed packages (NuGet Package Manager is supposed to do this, but I have experienced issues with being able to upgrade dependencies that are unsupported) 4) Read this post before tinkering with Xamarin.Android.Support libraries (upgrading these libraries without understanding why has caused me heartache many-a-time) 5) If you find yourself having a lot of build and/or deployment errors, close Visual Studio and delete all bin & obj folders AND your packages folder (manually) in your solution (use your file browser)

    If the only remaining explanation is a corrupt package; you can clear your NuGet global cache by deleting the following folders (substitute your user name):

    C:\Users\user\AppData\Local\NuGet\ C:\Users\user.nuget\packages\ C:\Users\user\AppData\Local\Temp\NuGetScratch\

    Anyways, gotta get back to the grind- glad you were able to get things working again!

    @MarcusI said:

    @DFoulk said: Just in case the above solutions don't work for someone:

    1. Clean your solution (Debug & Release)
    2. Uninstall the application on your device (or emulator)
    3. Deploy your solution

    For me this worked. I only needed to right-click the solution and choose Clean Solution and everything worked. Didn't even need to uninstall the app first. Must have been some leftovers in the solution/project since my previous updates and upgrades of Xamarin and Visual Studio. Seems like I always run into some kind of problem after installing Xamarin updates so now I don't know if I dare update anything again unless I really have to.

    Tuesday, October 3, 2017 4:49 PM
  • User347433 posted

    @DFoulk said: Just in case the above solutions don't work for someone:

    1. Clean your solution (Debug & Release)
    2. Uninstall the application on your device (or emulator)
    3. Deploy your solution

    These steps (somehow) fixed the crashing for me. No changes were made to anything in my solution- it simply resolved itself after completing the steps above!

    Hope this helps...

    thank you so much this really solved my problem it happened after I change linking to (sdk and user assemblies) and enable proguard

    I notice changing project settings causes some problems last time I've only changed the version number and suddenly the App page disappeared! had to add it again but then it gives me error "The name 'InitializeComponent' does not exist in the current context" so I had to remove InitializeComponent(); method from app

    Sunday, October 22, 2017 7:52 PM
  • User310833 posted

    @msdYqb said:

    @DFoulk said: Just in case the above solutions don't work for someone:

    1. Clean your solution (Debug & Release)
    2. Uninstall the application on your device (or emulator)
    3. Deploy your solution

    These steps (somehow) fixed the crashing for me. No changes were made to anything in my solution- it simply resolved itself after completing the steps above!

    Hope this helps...

    thank you so much this really solved my problem it happened after I change linking to (sdk and user assemblies) and enable proguard

    I notice changing project settings causes some problems last time I've only changed the version number and suddenly the App page disappeared! had to add it again but then it gives me error "The name 'InitializeComponent' does not exist in the current context" so I had to remove InitializeComponent(); method from app

    I'm glad that helped you. I would put the InitializeComponent() method back where it was... That's an important call for XAML Compilation!

    The reason that method was throwing an error was because you cleaned your solution- but did not (yet) rebuild the solution. After you rebuild the solution- that error will go away and the call for that method will no longer throw an error.

    See any of these threads for details: Google Search Results

    Let me know if you have any questions man!

    Monday, October 23, 2017 7:01 PM
  • User347433 posted

    @DFoulk said:

    @msdYqb said:

    @DFoulk said: Just in case the above solutions don't work for someone:

    1. Clean your solution (Debug & Release)
    2. Uninstall the application on your device (or emulator)
    3. Deploy your solution

    These steps (somehow) fixed the crashing for me. No changes were made to anything in my solution- it simply resolved itself after completing the steps above!

    Hope this helps...

    thank you so much this really solved my problem it happened after I change linking to (sdk and user assemblies) and enable proguard

    I notice changing project settings causes some problems last time I've only changed the version number and suddenly the App page disappeared! had to add it again but then it gives me error "The name 'InitializeComponent' does not exist in the current context" so I had to remove InitializeComponent(); method from app

    I'm glad that helped you. I would put the InitializeComponent() method back where it was... That's an important call for XAML Compilation!

    The reason that method was throwing an error was because you cleaned your solution- but did not (yet) rebuild the solution. After you rebuild the solution- that error will go away and the call for that method will no longer throw an error.

    See any of these threads for details: Google Search Results

    Let me know if you have any questions man!

    Fixed after changing the build action to embedded resource and the error gone ... thank you again! it turns out after re adding the page the build action wasn't the same I still don't understand why we need InitializeComponent(); in App my application runs fine without it

    Monday, October 23, 2017 9:24 PM
  • User310833 posted

    As well as setting the MainPage property, the code-behind must also call the InitializeComponent method in order to load and parse the associated XAML.

    Source: Xamarin.Forms Application Fundamentals

    You must not be using XAML, because if you remove this method from any view- said view will not load your XAML. Though this results in no compilation nor runtime errors- it does result in missing content in your application. It can be a bit confusing (no compilation/runtime exceptions == stable, right?) lol...

    @msdYqb

    Monday, October 23, 2017 9:44 PM
  • User263547 posted

    It seems that there is no solution for me, I've tried everything and nothing works

    Monday, November 27, 2017 11:30 PM
  • User350777 posted

    Hi All, I found this thread online looking for a soolution.

    I had my app working and deployed, both release and debug, but kept tidying up code to improve speed and recompiled using the latest version of VS 2017 comunity preview .

    Then , suddenly, this bizarre issue,

    Works in debug, but will not work in release.

    @DFoulk

    Did you mean select debug, the clean followed by select release clean, uninstall from device ?

    Friday, December 29, 2017 5:54 PM
  • User310833 posted

    @Oneday said: Hi All, I found this thread online looking for a soolution.

    I had my app working and deployed, both release and debug, but kept tidying up code to improve speed and recompiled using the latest version of VS 2017 comunity preview .

    Then , suddenly, this bizarre issue,

    Works in debug, but will not work in release.

    @DFoulk

    Did you mean select debug, the clean followed by select release clean, uninstall from device ?

    That's the gist of it. Alternatively, you can perform step 5 in my comment above.

    If you are comfortable with the actions I recommended above; you can use these helpful PowerShell scripts to clean your app & fix the EmbeddedResource bug:

    Clean-App.ps1

    Fix-EmbeddedResource-Bug.ps1

    Please review the contents of these scripts before running them, confirm that they will work in your environment and most importantly: MAKE A BACKUP OF YOUR SOLUTION BEFORE RUNNING!

    The scripts above are what I use to fix these issues when they come across my desk (seems like every other day)...

    Clean-App.ps1 Instructions:

    1. Select the root folder for your Xamarin.Forms app in the folder browser dialog
    2. Answer any questions that the script asks (via prompt)

    Fix-EmbeddedResource-Bug.ps1 Instructions:

    1. If using Git, make sure your repo has a clean working copy (no uncommited changes)
    2. Run the script
    3. Select the root folder for your Xamarin.Forms app in the folder browser dialog
    4. If using Git, click 'Yes' when prompted to run 'git reset'
    Friday, December 29, 2017 6:17 PM
  • User350777 posted

    @DFoulk

    Thanks for that.

    I got it to work eventually, by switching the linker off(Release AND debug mode). I had fundamentally misunderstood what linker does.

    However, I have reason to believe that using the linker in debug mode affects the same setting in release mode

    initially i only selected "none" for linking in Release mode. The App only worked after I went back and also selected "none" for linking in debug mode

    A bug perhaps, hope my description makes some sense

    Plus I did multiple cleans in both modes and uninstalls

    Friday, December 29, 2017 6:42 PM
  • User310833 posted

    @Oneday said: @DFoulk

    Thanks for that.

    I got it to work eventually, by switching the linker off(Release AND debug mode). I had fundamentally misunderstood what linker does.

    However, I have reason to believe that using the linker in debug mode affects the same setting in release mode

    initially i only selected "none" for linking in Release mode. The App only worked after I went back and also selected "none" for linking in debug mode

    A bug perhaps, hope my description makes some sense

    Plus I did multiple cleans in both modes and uninstalls

    Yeah man, if you are releasing an app to the public- then you will want to utilize linking. Specifically, you'll want to link 'Sdk and User Assemblies'. I enable this in both Debug & Release. By enabling this in Debug mode, you will be able to see any exceptions caused by linking in your debugger. AKA- no more invisible exceptions in Release builds.

    By linking all assemblies, you can shrink your apps size to 30% of the original (unlinked) package. Literally.

    Sounds like you've found this already, but in case others need it: Linking on Android - Xamarin

    If you haven't already noticed: ProGuard will cause similar issues for you if not configured properly. But (yet again) is recommended for production apps.

    Glad you got your app up and running again!

    Friday, December 29, 2017 6:53 PM
  • User354886 posted

    Thank you @rzee7. Your solution solved my problem.

    Monday, January 1, 2018 10:08 AM
  • User352208 posted

    Thank you @rzee7 . I got the same issue. Now It is working fine with your solution. But, why this sdk assembly only ?

    Friday, April 13, 2018 6:57 AM
  • User328188 posted

    @DFoulk said: Just in case the above solutions don't work for someone:

    1. Clean your solution (Debug & Release)
    2. Uninstall the application on your device (or emulator)
    3. Deploy your solution

    These steps (somehow) fixed the crashing for me. No changes were made to anything in my solution- it simply resolved itself after completing the steps above!

    Hope this helps...

    This worked for me. I have run into this issue before and changing the Linking options and setting internet worked to resolve this issue for me originally, but this time around the solution I quoted above is what finally did the trick. Thanks for that!

    Monday, June 18, 2018 7:14 AM
  • User310833 posted

    @BlueCoder77 - Glad it got you sorted. The OP's exception appears to have been caused by the linker removing some logic that the app needed to run. The solution provided by @rzee7 tells the linker to skip the "alarm" assembly- thus said logic is not stripped out of the build (which fixes the exception).

    If the exception just showed up (without you dinking around with linker or after you've built successfully in Release config and haven't changed your code) then the solution provided by @rzee7 probably won't help ya!

    Again, the recommended solution to exceptions related to linking is to try to configure linker to link as much of your code as possible- without removing stuff that you need. The package size difference can be pretty dramatic if you skip entire assemblies (instead of trying to solve the problem via configuration). Just read the docs on linking and if you really want to be serious; checkout Custom Linker Configuration.

    Tuesday, June 19, 2018 6:02 PM
  • User369223 posted

    I've got same issue. My app is working well on many android emulator but when I install a real device, it crashes after launching and gets error like "Application Name" has stopped. Also application Icon seems black. I need a help.

    Wednesday, June 20, 2018 3:46 AM
  • User370151 posted

    My android xamarin forms app stopped working immediately after release build & deployment. What fixed this for me was to first build the Portable parent project together with the Android project. The tick box to build Portable was in Solution Properties > Configuration Properties > Configuration.

    Monday, June 25, 2018 8:54 AM
  • User364248 posted

    If I use Don't Link linker option, the app runs in release mode but the size of the app is huge. If I change the linker property to Link all assemblies then the size reduces dramatically, but the app crashes right after the launch screen.

    Friday, June 29, 2018 2:16 AM
  • User369688 posted

    My app was perfectly working on both iOS and Android in Debug mode, I tried to use Release mode, now my app is broken (bindings doesn't work anymore), of course i didn't change the code btw. I tried all solutions listed above including (tested on Android 7.0 - Samsung G S6 and iOS 10.3.3 - iPhone 5C) => Debug mode * ...

    Release mode * Turn on / off use shared runtime

    Both mode * Try all linking options * Enable / disable proguard * Add --linkskip=alarm * Clean solution + uninstall app from device + rebuild * Add / remove internet permission

    I hope someone can help me

    Wednesday, July 11, 2018 7:45 AM
  • User370420 posted

    Any solution on this ..?? I am also stuck at same.!!!

    Saturday, August 4, 2018 5:31 AM
  • User372168 posted

    I am also stuck at same point please if any one can help

    Sunday, September 2, 2018 9:24 AM
  • User306403 posted

    @DFoulk said: Just in case the above solutions don't work for someone:

    1. Clean your solution (Debug & Release)
    2. Uninstall the application on your device (or emulator)
    3. Deploy your solution

    These steps (somehow) fixed the crashing for me. No changes were made to anything in my solution- it simply resolved itself after completing the steps above!

    Hope this helps...

    I applied same things that you mentioned , it is working in release mode without changing anything Android project properties. Thanks :)

    Tuesday, September 18, 2018 5:36 PM
  • User37393 posted

    I am using the latest VS 2017 15.8.9 and am experiencing this problem using API 28. The application is uninstalled from the device (pixel 2 running Android 9). The application is then run in debug mode on the device. It runs perfectly. I then reboot the device and run the application that was uploaded by the debugger. It starts to work and then crashes. I have tried it with / without shared run time, linking and no linking, AOT compilation or not. It is the same result every time - i.e. it works under debugging and crashes when not being debugged.

    I am having great difficulty in trying to track down why it is crashing. Any advice on how to do this would be greatly appreciated.

    It works perfectly on all devices running API 27 or earlier whether under the debugger or not.

    So I then thought - ok I will set the Compile target API to Oreo instead of Android 9. This appeared to work but created an APK file that has no permissions (the permissions were there, but they were all switched off and you had to go into the settings for the app to turn them on)

    To cut a long story short - this is causing me major grief. I need to get a new release out immediately but I am completely stuck.

    Friday, November 9, 2018 12:24 PM
  • User236903 posted

    First of all check your permissions. In debug mode as i notice permissions dont force your application to crash, but in release mode they will. Also try to clean and rebuild your project

    Tuesday, November 13, 2018 6:36 AM
  • User377208 posted

    @Sivamuralidhar said: check the internet permission property in Android manifest file.

    This solved my problem. Thanks a bunch

    Sunday, January 20, 2019 4:09 PM
  • User272328 posted

    @DFoulk said: Just in case the above solutions don't work for someone:

    1. Clean your solution (Debug & Release)
    2. Uninstall the application on your device (or emulator)
    3. Deploy your solution

    These steps (somehow) fixed the crashing for me. No changes were made to anything in my solution- it simply resolved itself after completing the steps above!

    Hope this helps...

    Thank you, It's work for me!

    Sunday, May 26, 2019 2:05 AM
  • User310833 posted

    @"Liêm_Nguy?n" said:

    @DFoulk said: Just in case the above solutions don't work for someone:

    1. Clean your solution (Debug & Release)
    2. Uninstall the application on your device (or emulator)
    3. Deploy your solution

    These steps (somehow) fixed the crashing for me. No changes were made to anything in my solution- it simply resolved itself after completing the steps above!

    Hope this helps...

    Thank you, It's work for me!

    Glad to hear it! :)

    Tuesday, May 28, 2019 6:04 PM
  • User391273 posted

    This was also my case: The app was running great in debug, but crashing on release.

    The solution for it was disabling any code shrinker. This (the code shrinkers) seems to have a problem. At first I thought that it was only ProGuard, but also r8 was not working.

    I checked for the other solutions mentioned above, but non of these worked for me. This was the only solution I found.

    Hope this helps,

    Regards.

    Friday, December 20, 2019 4:17 PM
  • User241980 posted

    @arturobazil said: This was also my case: The app was running great in debug, but crashing on release.

    The solution for it was disabling any code shrinker. This (the code shrinkers) seems to have a problem. At first I thought that it was only ProGuard, but also r8 was not working.

    I checked for the other solutions mentioned above, but non of these worked for me. This was the only solution I found.

    Hope this helps,

    Regards.

    @arturobazil Thanks, it solved my problem.

    Monday, April 6, 2020 6:25 PM
  • User396144 posted

    Hello! My app is crashed only in release mode. And only when testing with Android 4.4. My VS version is 16.6.5, Xamarin version 4.8.0.1269, target platform Android 10 Q. From logcat:

    ! I/InputDispatcher( 517): Window 'Window{41a73f80 u0 com.company.app/crc64af97da7f61d9614a.MainActivity}' spent 3238.9ms processing the last input event: MotionEvent(deviceId=2, source=0x00002002, action=7, flags=0x00000000, metaState=0x00000000, buttonState=0x00000000, edgeFlags=0x00000000, xPrecision=1.0, yPrecision=1.0, displayId=0, pointers=[0: (873.6, 555.1)]), policyFlags=0x42000002 ! I/ActivityManager( 517): Displayed com.company.app/crc64af97da7f61d9614a.MainActivity: +5s424ms ! I/DEBUG ( 124): pid: 4918, tid: 4918, name: com.company.app >>> com.company.app <<< ! I/DEBUG ( 124): bef99160 762c98af /data/dalvik-cache/data@app@com.company.app-2.apk@classes.dex ! I/DEBUG ( 124): bef9919c 766e8c04 /data/app-lib/com.company.app-2/libmonosgen-2.0.so ! W/ActivityManager( 517): Force finishing activity com.company.app/crc64af97da7f61d9614a.MainActivity ! W/InputDispatcher( 517): channel '41a73f80 com.company.app/crc64af97da7f61d9614a.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 ! E/InputDispatcher( 517): channel '41a73f80 com.company.app/crc64af97da7f61d9614a.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed! ! W/InputDispatcher( 517): Attempted to unregister already unregistered input channel '41a73f80 com.company.app/crc64af97da7f61d9614a.MainActivity (server)' ! I/ActivityManager( 517): Process com.company.app (pid 4918) has died. ! I/WindowState( 517): WIN DEATH: Window{41a73f80 u0 com.company.app/crc64af97da7f61d9614a.MainActivity} ! This is a Xamarin bug? What to do?!

    Saturday, August 8, 2020 5:06 PM
  • User396144 posted

    @pro777 said: My app is crashed only in release mode. And only when testing with Android 4.4. This is a Xamarin bug? What to do?!

    The source of the problem was that Android API 19 does not support TLS 1.2. In the settings of the project "Android Parameters" I chose the implementation "Managed" of the HTTP Client, the problem was solved.

    Tuesday, August 11, 2020 4:44 PM
  • User398193 posted

    @DFoulk said: Just in case the above solutions don't work for someone:

    1. Clean your solution (Debug & Release)
    2. Uninstall the application on your device (or emulator)
    3. Deploy your solution

    These steps (somehow) fixed the crashing for me. No changes were made to anything in my solution- it simply resolved itself after completing the steps above!

    Hope this helps...

    Thank you that solved my problem. 3 years later and it still works XD

    Monday, November 30, 2020 7:05 AM