How to Debug an App Outside of Visual Studio 2019-Pre? - android

I have a cross-platform app that starts and runs fine in the IDE debug mode.
However, if the app, in a debug compilation, is started from either iOS or Android starts and subsequently fails; it runs fine on UWP though. I have had the app run on them in earlier versions.
What settings/logs on those OS's should I set to try and debug the executables?
Is there any documentation for working this type of problem?

Per this conversation, John suggested "application level unhandled exception handers on each platform" which I researched, found example code here and use it to form my own code to resolve the issue I was having.

Related

MAUI: Release build directly crashes on Android device

I built a .NET MAUI project and want to install this on my local device (Android 9). When i start directly out of VisualStudio as Debug build everything works well. When i change build type to Release, the splash screen is visible for a second and after that, the app closed directly.
I have no clue what the problem is. Is there an opportunity to debug release build or have a log view, why the app crashes instantly?
Thank you and best regards!

Xamarin no longer debugging my app

I've been working on a Xamarin project for a few days and have been testing it fine, but today it has suddenly stopped allowing me to debug the app, either via Live Player, or by connecting my smart phone via USB.
The only error I am getting, as far as I can see, is
Failed to debug your app
I've not got a way of testing it on iOS devices, but the built-in Windows Phone emulator runs the app fine, albeit with an error in my code popping up now and then.
What could be causing the Android version to stop debugging, or how do I at least fix it?
There are a couple of steps that can help with that issue:
Clean the solution and exit visual studio
manually delete the .vs folder in your solution directory
Delete the /obj and /bin folders in your shared code, and in each project for the platforms you are using
if you are developing for iOS, sometimes it helps to restart your mac
Start Visual Studio
Rebuild your shared code project
Rebuild every native project
Beyond that also make sure that you are using the latest versions of Visual Studio, Xamarin and Xamarin.Forms on all your computers, and that the nuGet Packages your project is using are at the very same version each in shared and native code
Also check, if your app isn't throwing an unexpected exception during its initialization. Especially if not caught, it can happen that your app crashes before your code gets executed at all.
In addition you may find further information about what is going on at Help -> Xamarin -> Open logs or in the device management in XCode (iOS only)
Try this :
Close visual studio if open.
Open App Data and then go to
(a) Local\Xamarin
(B) Local\Xamarin\Xamarin.Android
Empty these folders.
Open your project and then try to build your application.
Not a proper solution, but I uninstalled and reinstalled Visual Studio. This seems to have fixed the problem, but I've still no idea why it stopped working in the first place.

Problems running app on actual device

OK, please take it easy on me, I am new to the whole Xamarin community. I have built a simple calculator app using MVVMCross. When I run the app in an emulator everything works great. It still needs some UI attention, but functionally it all works. When I go to archive it and make an install on my phone, it installs just fine. The issue is when I go to run it. As soon as it opens I get an error message. "Calculator.UI.Droid has stopped" Open app again. I have gone through everything I can find online to do this and nothing is working.
Here is my setup:
Visual Studio 2017 Community with latest updates
Windows 10 with latest updates
Latest Java SDK
Project Properties:
Compile using Android Version 7.1 (Nougat)
Minimum Android Version 5.0
Target Android Version 7.1
Use Fast Deployment - false
Generate one package (.apk) per selected ABI - unchecked
Enable ProGuard - checked
Linking - SDK and User Assemblies
Android Phone:
Google Pixel 2 with latest updates.
Any help would be appreciative. Just let me know if you need more information. Thanks in advance
I myself are also using Xamarin, and quite often I get this problem, most times it is related to the code, so please make sure that's the case.
comment out your calculator stuff, and try running the basic app on your physical device. if that works try to find the problem, idk if you can use breakpoints because your problems happens on boot.

Xamarin Android app crashes on Release mode

Several months ago I updated Xamarin to 4.5.0.476 (Xamarin Android 7.3.1.2) and today, updating an App, I discovered that I cannot run my apk in release mode because it crashes when runs. And I can't understand why.
I tried to set all type of permissions on the android manifest.
Linker setting is SDK Assembly only but I also tried None.
I cleaned and rebuilt several times.
There's not conditional code that can fail on start-up.
Nothing, app always crashes when opening main activity.
Solved! In Advanced Android Option armeabi-v7a architecture was unchecked, there was only armeabi. I switched option on and app starts without run into error.

Cannot see Log messages from my android app in Android Studio logcat?

I am using Android Studio and wanted to see if I could get "prints" or logs from my app, which would help later in debugging of more involved apps.
My minSDK API is 9 and targetSDK API is 22.
So, I take the simplest HelloAndroid app, and add a Log.i with an appropriate tag in the oncreate method.
I install and run this app on my Samsung phone, which has the developer options set to enable USB debugging.
The app runs fine, and I can see the system logs.w or logs.i from the various managers, but I can't find the print message I had inserted.
I had already added debuggable = true in both manifest and gradle build script as well.
So, why can't I see my own log messages.
Thanks,
Har Yash
In my case, I needed to reinstall the application on my device to see at least the logs. It seems that android studio was not running the actual version of my code...
Maybe these links could help to solve the problem in that case:
how-to-reinstall-apk
how-to-resintall-app

Categories

Resources