Releasing a Xamarin Forms app as an Android App Bundle
My old Cordova app had a feature to export to Google Drive which used the InAppBrowser and this feature was broken because Google flagged this as a security issue. For reasons it was hard for me to update the Cordova app, since I had old tooling and I thought I remake the app using Xamarin Forms Shell. Below I describe some issues I ran into and what I did to solve it.
Up until the development phase I was running the app on the emulator. This ran a bit slower then normal but made it easier to debug as I haven't setup a WiFi connection. For releasing it I really needed to test the app running on a phone. After following the guide and setting up developer mode on the phone, enabling Usb debugging on the device and installing the usb driver on the pc, I first had to click allow when the phone was connected and the debugging started. However, this still did not work. I had to change the mode from File Transfer to File Transfer (Images). After this it finally worked.
I've build my Xamarin Forms Shell app as an Android App Bundle because it appeared to be the recommended way. I started using Xamarin Forms Shell when it still was experimental. My app has those experimental flags and I updated the NuGet packages a couple of times but I don't know if I need to remove those flags or not. After uploading I got an error from the Play Console about 64-bit support. It turned out that I had to go to Android Options and click the Advanced button and select there the 64-bit cpu architectures. No idea why this is on by default and if the x86-64 is needed. I just added that one too besides the arm one.
According to the documentation enabling ProGuard results in a smaller app size so I decided to try this. It was my assumption that a default configuration would be generated that works. The documentation talks about adding a cfg file but I assumed the default would work as it is just a combobox selection. This turned out wrong. I discovered that when uploading the Android App Bundle there are PreRelease tests being done. This can be found in one of the tabs the Google Play Console. It turned out there were 12 crashes because to much code had been stripped out during the linking and building of the app.
Before publishing I liked to use the internal test track to send the app to myself and another fellow tester. The internal test track is also handy to use because of the Android App Bundle is harder to install directly to a phone. I created the test track, made a list of testers and was ready to start. However, I couldn't press the final button to start implementation because it was greyed out. In hindsight it was logical but it took me a while to figure out as there was no tooltip or message why it was greyed out. The solution was to complete all the other steps in the Play Console with the grey checkmarks stating what to do and which you also need to do when publishing the app to the real Play Store, such as creating Store images and adding screenshots. Somehow I expected this was not necessary for a test release. After the button finally was enabled I clicked it and everything was successful. Yay. Then I wanted to send it to the testers in the list. I did not find a button for this and after searching I read that I get a link in the Play Console in the releases tab with the testers. However, the place where the link was turned out to be empty. For a test release you also have to wait until Google approves it and after two days I finally had a link and emailed it and opened it and it worked perfect and the test release was a success.
Conclusions. There were a couple of bumps and some not documented so well obstacles but in the end it was a success. After having done this, the subsequent releases went much smoother.