Updated visual studio 2019 to visual studio 2022 and now xamarin android app crashes on startup - android

I updated my visual studio 2019 in order to build android apps with version >=12 as play store requires.
I’m using xamarin.android to develop my app, not xamarin.forms.
When I try to build the app and deploy on a physical device (Android version 11.0), as soon as the initial screen is displayed it crashes.
No exception/error is displayed in visual studio and when I try to open the app directly on the my device, it works fine.
I reinstalled all the nuget packages as some people suggested, enabled/disabled fast deployment, deleted obj/bin directories, nothing really worked yet…
Building my app with vs19 was working fine.
Anybody can help me with that?
I reinstalled all the nuget packages as some people suggested, enabled/disabled fast deployment, deleted obj/bin directories, nothing really worked yet…

Related

xamarin android "Preserve data/cache" doesn't work

Every time I deploy my android project, the app data has been wiped. This applies both for Visual studio for mac and windows. I have previously been work with Xamarin and android development on a samsung s7 which also had the issue, but I some how fixed that, I just can't remember how. Now my new S9 has the same issue where "Preserve data/cache between application deploys" is not respected.
I have tried toggle the check mark for "Preserve data/cache between application deploys" several times, restarting the phone, updating OS visual studio and android sdks, but nothing seems to help.

My mac suddenly freezes while using Android Studio 3.2

I am doing the Android Basics: Data Storage course on Udacity, and I have almost finished this course, but since about a week ago while using Android Studio and doing everything that the course teaches me to do, at some point Android Studio completely freezes my Mac OS and that forces me to reboot my computer.
This problem happens at any time, literally. There wasn't anything special that Android Studio was trying to do when this happened. Many times I have been just writing some code, and it freezes, not running the project, downloading something in the app or checking anything special, it just suddenly freezes.
I am using Android Studio 3.2 (latest version) in a MacBook Pro (13-inch, Early 2011). It also happened before I update it to Android Studio 3.2, when I had the previous version I thought I could be fixed by delete Android Studio and download the latest version, but it did not work.
I have a solution for this problem.
I seem to have a problem occurs with the Java version of Android Studio crashes
So check your Java version. I think you are using JAVA 1.8
Please remove all java on your system like below.
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8.0_80.jdk/
then download and reinstall latest java 1.8
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
I will hope you can resolve this problem
If your machine freezes, it could be due to either you open too many apps that consume much RAM with Android Studio, hence when Android Studio needs some more RAM to operate (i.e during gradle build or instant run), the machine could not provide sufficient RAM hence, Android Studio will freeze: or your machine does not meet minimum system requirements for Android Studio, for this information, you can check the official documentation https://developer.android.com/studio/ . Also, in order to manage memory usage, have a look on this link https://macpaw.com/how-to/reduce-memory-usage-on-mac
I had something similar after updating to 3.2.
Wasted 4 hours trying to fix it and eventually followed these instructions to totally wipe AS from my PC.
How to completely uninstall Android Studio from windows(v10)
I understand that you have MacOS but it wouldn't be too difficult to locate the directories there.
For those who are looking for a solution when is using tabs just is because
Android Studio freezes on macOS Big Sur. On machines running macOS Big Sur, Android Studio 4.1 might freeze when you open a dialog.
To work around this issue, do one of the following:
Go to the Apple Menu, select System Preferences > General. In the Prefer tabs when opening documents option, select "never". Then restart Android Studio.
Upgrade to Android Studio 4.2, currently available in the Beta channel.
Otherwise, wait for the Stable Android Studio 4.2

Xamarin.Forms Visual Studio 2017 project does not deploy

I am new to Xamarin. I used Xamarin. Forms template to create a sample mobile solution in Visual Studio 2017. The process created four projects Xamarin PCL, Xamarin Android, Xamarin.iOS and Xamarin.UWP. Without making any modification to the generated solution, I am trying to run it.
The first issue is, when I set the UWP as the starting project, the Windows emulator shows up and runs the app perfectly. But when I try to do the same with Android, I get different errors at different times based on the environment changes I make. Finally, using the visual studio android emulator, the Phone UI shows up but not my app. In the background, I can see that Visual Studio completed the build process successfully without any errors but the deploy process simply hangs. I left the deploy running overnight but still running in the morning. Here is my environment.
Intel Core i7 processor
Virtualization enabled in BIOS
Windows 10 Education
32GB RAM
Hyper-V disabled in Windows
Executed bcdedit /set hypervisorlaunchtype off in the command window and rebooted.
I tried setting the above environment in different combinations but none of them seem to make the app work. When I use an android emulator from android SDK, the build process throws errors. The only emulator that even builds is the visual studio emulator. But the deploy hangs.
A second issue I have is, I have installed android SDK for version 24 and 25. But in the emulator dropdown, I can only see the emulators for 23. I checked the installation path both in visual studio and android SDK manager and they both point to the same installation folder. What do I need to make the emulators for version 24 and 25 usable?
I repeat, I did not make any change to the generated solution in visual studio before running it. I have been at it for the past three days and couldn't make it work. Please help.
I just installed Visual Studio 2017 (on Win10 15063.138) and found, like you, Xamarin projects won't deploy to Android. Here's how I got running:
Updated everything in the Android SDK Manager.
Installed the new, improved Android Emulator from MS:
https://www.visualstudio.com/vs/msft-android-emulator/
Used that to download/install an API level 23 (6.0 Marshmallow)
emulator
Started that emulator using the same tool (you'll see it running in Hyper-V Manager)
Selected same emulator in VS for deploy/debug (the emulators that ship with VS are painfully slow)
In VS, selected Android project for start-up and verified build and deploy to Android in build config mgr.
Note: MS doesn't appear to have any emulators above API level 23, so Compilation and Target settings for your Android project can be the latest, but the minimum target will have to be 6.0 (API 23).
After pulling my hair for the past few days, I finally got my Xamarin.Forms Android App to show my page on the emulator. Thanks to all the members for their suggestions. Ryan's suggestion helped a lot ( I +1ed him, thanks Ryan) but did not solve my problem. I googled further and found a suggestion that asked to change the following setting which did it for me finally. So, if anyone else get stuck like I did, please do the following (in addition to cleaning up and updating all packages):
Open up the setting for your Hyper-V vm for your emulator (while the VM is off).
Expand the Processor node on the left and click on "Compatibility".
Now put a check mark on "Migrate to a physical computer with a different processor version" on the right.
Start your emulator in the Visual Studio Emulator tool.
Now, start debug your android project in VS using the same emulator that is already running.
After a delay (there is always a delay), your app will show up on the emulator. Yey!!

Is there an alternative Android emulator for Visual Studio on Windows 10 Home

When using Visual Studio 2015 to develop c++ for Android the emulator only works if you are running a Pro version of Windows, for those using Visual Studio Community who are probably also running on a Home version of windows (like me) the Emulator will not work.
Is there an alternative available that can integrate with the VS debugger?
*** Edit
I have been looking at this list Android emulators although this seems to be aimed at android gaming on PC rather than App development. So was wondering if anyone had managed to integrate one of these with Visual Studio?
Both the below options come with the caveat that I have not used either.
Xamarin Android Player
Apparently Xamarin had issues with the default Android Emulator. Primarily that it was slow, and clunky, and they were getting a lot of complaints about it from Xamarin users (despite it not being their product/fault).
They decided to create their own emulator to get around this, and it can be found here.
It should be noted that (at time of writing) this is still in Preview by the looks of things. So bugs may be present.
From what I can see on the download page, it doesn't appear like you need Xamarin to actually use it. In any case, it's worth a shot.
GenyMotion
Another option is GenyMotion. There is a free version for personal use only (with limited functionality), or a paid option that provides more capability.
Android player link has changed to here: https://developer.xamarin.com/releases/android/android-player/
I had problems starting the android VMs, even after restarting the host. There seems to be some incompatibilities between Windows 10 Home and Virtualbox 5.0.4 that Android player installs. Installing Virtuallbox 5.1.2 after installing Android player seems to have resolved this.
EDIT: I haven't had a chance to test integration with Visual Studio yet.
Everything seems to be working as expected within Visual Studio. Both of the VM devices I created in Android Player are visible in the drop down of the run menu. Visual Studio will start the selected VM when I debug the default blank android app.
The only hiccup is that Visual Studio doesn't wait long enough for the emulator to start before attempting to deploy the app. So I have to start the run again or remember to start the VM from Android Player before debugging.

Getting my old version of Eclipse SDK Version: 3.6.2 up and running again?

I have written a number of simple apps for Android, but have not posted any on Android Market / Google Play for about a year or two. I recently wrote a very simple app but when I tried to post it to Google Play I get the Error:
You uploaded an APK that is not zip aligned. You will need to run a zip align tool on your APK and upload it again.
Google must have changed something while I was napping.
After a little research I found that I needed to load the latest version of Eclipse as the Export/Signing tool included in the newer versions also does this zip aligning.
This was a mistake I think.
First I tried to get the update function on the Eclipse SDK Version: 3.6.2 I had been using but this did not work. In frustration I simply loaded the latest version of the SDK off the Android site. This worked fine but the Emulator that comes with it is far too slow on my computer (MacBook Pro OS 10.6.8, 2.4 GHz Intel Core 2 Duo, 2 GB 667 MHz DDR2 SDRAM). I tried a number of suggestions on getting a faster Emulator, none of which worked.
Since the emulator on my 3.6.2 version of Eclipse worked just fine for the simple apps I write I said well I will just use that version of Eclipse and zip align my app manually. Unfortunately, now ALL my apps on the older version of Eclipse have errors in them preventing them from working. I keep on getting the error:
[2014-05-18 22:53:56 - Focal Length] Unable to resolve target 'android-19'
This is understandable as I only have API 17 installed on this older version of Eclipse (that is as high as I could load on this version). I thought, fine I will just uninstall the latest version of Eclipse then the old one will work fine. No luck, when I uninstall the latest version of Eclipse and even use an app cleaner on my Mac I still get the same error:
[2014-05-18 22:53:56 - Focal Length] Unable to resolve target 'android-19'
Somewhere in my old Eclipse there is a pointer asking for API 19 which does not exist on my old version of Eclipse.
I would like to simply use my old version of Eclipse and zip align my app manually as outlined in on the Android site.
Can someone help me in getting my old version of Eclipse SDK Version: 3.6.2 up and running again?
either change your android target to lower version. or open up android sdk manger and install android 4.4.2 sdk.
Never found solution, tried everything, numerous suggestions from stack overflow. I could never get my apps to work on my old version of Eclipse no matter what. New version of Eclipse still too slow of Emulator. Tried running apps directly off my phone, Samsung Galaxy S3 but could not ever get Eclipse to recognize it. Tried loading and running Samsung Kies no help. Only way I could modify app was to open it on latest version of eclipse, run it, kill the run, and then email the apk file to my phone. This worked but the text was then all off. Tried to correct that also and now the new version of Eclipse has nothing but errors in it.
Final solution? Back up my Workspace files and uninstall all versions of Eclipse on my Mac along with any remnants I can find.
I will then reload the latest version of Eclipse and manually enter the code in for my app and see if that works.
Just a work of experience from an 54 year old chemical engineer that has designed almost any type of chemical plant there is (and used punch cards in college!). Even though most chemical plants are computer controlled there is always a manual OFF switch so that operators at 3 AM in the morning can shut things down safely without having to look for the "bug" in the program.

Categories

Resources