UWP store build with Xamarin Forms - xamarin

We are having trouble publishing our x86/x64 UWP Xamarin Forms app to the Microsoft Store.
The app got rejected because the certification team cannot test the .appxupload package because it crashes on startup.
The app only crashes when installed from the store built .appxupload package. The .appxbundle in _Test works fine and we are using it for in-house distribution and sideloading via HockeyApp.
At first we assumed that the crash was due to faulty packaging as our app uses the desktop-bridge feature to bundle a small WPF executable with it. Our first instinct was to remove the desktop bridge part and test the packaging again. After removing it, we had the same issue, the .appxupload crashed on start.
We took it one step forward and just created a new solution with a new Xamarin Forms Template project (VS 15.7.1). Without changing a single line of code we packaged the visual studio xamarin forms uwp template project for store upload. The surprise here is that the generated .appxupload also crashes exactly the same way on startup.
We decided to find out more by experimenting on the Visual Studio XF uwp template:
Update XF to 3.1 -> still crashes
Update .NETCore.UniversalWindows to 6.1.5 -? still crashes
Remove XF from the project completely (including Xamarin.Forms.Init(..)) -> no more crash, but also no more content without Xamarin forms ... :(
We have researched the following posts which seem to be related to this issue:
https://bugzilla.xamarin.com/show_bug.cgi?id=59538
https://developercommunity.visualstudio.com/content/problem/150965/xamarin-forms-project-uwp-app-dies-on-start-when-i.html
Could not load file or assembly 'System.Private.CoreLib...'
Some of the above posts were explaining that even though the .appxupload crashes when installed locally the when downloaded and installed from the Microsoft store the package will run without a problem. Our problem with this part is that our .appxupload package needs to be tested by Microsoft before the store publish because of the desktop bridge permission. Because it crashes when locally testing it cannot be published.
Based on our experiments with the Visual Studio Xamarin forms uwp template project this seems to be an issue of UWP and Xamarin Forms together.
We are not sure how to proceed. We need to get the app running from the .appxupload package so that it can be tested by the store team. Do you have any ideas/solutions for this issue?

Related

Visual Studio App Center Android Build Project not finding Solution Files

I am trying out the new Visual Studio App Center for a mobile app I am writing.
I have three solutions checked into VSTS Git. The first solution named App.sln is a master solution that has 2 solution folders, Apps and Services. The Apps folder has 3 projects App.csproj which is a .NET Standard 2.0 library containing the Xamarin Forms shared code. App.iOS.csproj is the Xamarin Forms iOS project. Finally, App.Droid.csproj is the Xamarin Forms Android project. The Services folder contains project files written in ASP.NET Core 2. The second solution is a solution named App.iOS.sln containing just the iOS and App library projects. The last is a solution named App.Droid.sln containing just the Android and App library projects.
In App Center I have 2 Apps configured per the instructions for Xamarin Forms apps. The first is an App configured as iOS Xamarin app. The second App is configured as Android Xamarin app.
I configured the analytics and crash reporting which works. I then configured the builds and this is where I have run into an issue. Specifically the Android build configuration project drop down only sees the App.Droid project. The iOS App build configuration project drop down sees all three solutions but only the App.iOS project. I selected the App.Droid and App.iOS projects. It seems to work. However I'm concerned that in the future things might break. I rather select the App.iOS and App.Droid solutions. That way I know that the correct projects are compiled and nothing not need is compiled. This is especially true since I am trying to stay within the free compile time budget until the MVP is done. Any ideas how to accomplish ensuring only the right projects are compiled?
According to App Center team (on Jan 30, 2018):
Unfortunately we do not support the selection of sln's with Android
Xamarin, currently solution file is only supported for iOS.

Multiple errors after updating Xamarin Forms

I'm using Visual Studio 2017, and I stared a new Xamarin Forms app:
Create New project - Cross Platform App (Xamarin)
Blank App, and I chose Portable Class Library (PCL)
The app compiles and runs.
Now I right click the solution and choose Manage Nuget packages for solution, and it tells me I'm running version 23.3.0 and I should update to 25.4.0.1
After the update and 3 VS reboots, it gives me a host of errors I have been trying to solve for an hour including googling.
All theme related.
I tried removing the styles.xml file all together. I removed the theme from the reference to the theme from the manafest and it keeps putting it back.
I can't figure out what I'm doing wrong. I have not written any code.
Xamarin Forms requires a specific version of the Android Support libraries. Do not update them.
Delete your project and create a new one.
It is possible to get round this limitation by ensuring you are using a specific version of Android and by updating all Android SDK's, but for a beginner I would recommend just using the support libraries that are installed alongside Xamarin Forms.

Debugging Xamarin Android apps if I'm using VSTS hosted builds / HockeyApp

I have been developing a Xamarin Android app using Visual Studio Community 2015. So far, everything has been working well for debugging, as I simply build my app in VS, and connect my phone to my laptop and debug it using F5.
Recently, I started using HockeyApp for crash reporting, so that as I'm using my app (during the day when I'm not programming), if it crashes, I can send crash reports. This works OK, but the crash reports don't include line numbers, and also I don't have good references to what build of the app crashed, as the app itself isn't actually getting uploaded to HockeyApp, nor are the debugging symbols.
To help with this, I'm trying to get more organized using Visual Studio Team Services, doing hosted builds upon checkin of my source code, and automatically uploading the app and debugging symbols to HockeyApp.
Now I'm trying to reconcile in my mind how this is supposed to all work for me. If I'm coding in VS and debugging through VS, the app is getting deployed to my phone. But now, I check in the source code, and VSTS does a CI build and uploads everything to HockeyApp. But now, the CI build that VSTS did isn't really the same build that's on my phone, since that build came from the Visual Studio build.
So, when I'm done coding then later in the day, I run my app and it crashes, I'm concerned that the crash report from HockeyApp isn't actually going to relate to what Hockeyapp has. For one, I may not have done a check-in to the source control, in which case, my phone will have a newer version than HockeyApp has. But even if I had remembered to check it in, it's really not the same "build" (since my phone has the APK that was built by Visual Studio and HockeyApp has the APK that was built by VSTS).
Questions:
1) Is there a way to upload my app and debug symbols directly from Visual Studio, without going through a VSTS build? (preferrably automatically upon every build, so that I don't have to remember to do an extra step)?
2) If not, what are the best practices to resolve the issues that I mentioned above?
Ideally, I don't want to have to do any extra steps when I'm done coding for the day. I want to be able to always know that the last version that I built and deployed to my phone will have been uploaded to HockeyApp, so that if it crashes, the crash repo that HockeyApp sends will match with the correct source code and debug symbols.
For your first question, This depends on the project you working on. If you are working on a UWP project, there is an "Enable Crash Analytics" option and "Distribute With Hockey App" option allow you to do this when you right click on the project. But if you are working on a Xamarin.Android project, there is no option to do this. You need to upload them to Hockey App manually. However, you can create a power-shell script to upload these files to Hockey App and configure this power-shell script as post-build event. You can check the power-shell script here for reference: upload_file.ps.
And for the Visual Studio Team Services(VSTS) build, you just need to make sure that the app version and build configuration is totally the same as you debugging through VS from your local machine. Hockey App will detect the version automatically and send the data to the related build version.

Multiple errors when creating Xamarin.Forms - Blank Xaml App (Xamarin.Forms Portable) or Android App

I using Windows 10 and am trying to create a Xamarin.Forms - Blank Xaml App (Xamarin.Forms Portable) project for the first time. I have Visual Studio 2015 Enterprise Update 3 installed and have tried uninstalling, reinstalling, and repairing multiple times.
When I create a project, I get the following errors:
"The name 'InitializeComponent' does not exist in the current context"
"Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled" - for App, Droid, UWP, WinPhone, Windows, and iOS
"The XamlCTask task failed unexpectedly..." - for UWP, WinPhone, Windows, and iOS
I tried this on my work computer and home computer and I had the same issues with both.
I have tried updating Xamarin.Forms nuget to the latest version and the created 36 errors with Droid. I also tried going to c:/users/[YOURNAME]/AppData/Local. Delete the Xamarin folder and that did not solve the issue.
I tried creating other Visual Studio projects that did not involve Xamarin and did not have any issues with those. I know the issue is with Xamarin (probably something with Android) itself, but I don't think that there is anything that I am missing from the install. I tried installing it by first installing Visual Studio, then going to Modify and adding Cross Platform. That didn't work, so I uninstalled then downloaded the Xamarin Installer. I had the same issues with both.
I created a blank Android App and that give me the warning - "aapt.exe" exited with code - 1073741849".
A blank app for iPhone does not give any errors or warnings.
Windows Phone does not give any errors or warnings either.
Any ideas of what I should check for so I can get this working?
Here is a picture of the error that I'm getting
Try updating to the latest version of Forms to get rid of the XamlC errors. Assuming you haven't updated, the template is using a modestly old version. As for the aapt error, if you have the N SDK preview installed, removing that should help. Alternatively, make certain that you have up through API 23 installed.

Xamarin Windows Phone Store Package

I' am in a bit of truble at the moment.
I try to build my Xamarin Windows Store App for publishing, but the Create App Packages Wizard, wont open I tried many solutions from the web, like unloading and reloading the project, or making a new project. But the wizard does not open with my solution i treid a normal Windows Phone app(no Silverlight), that worked but i could not Port my xamarin project to a standard Windows Phone App.
Has someone encountered a similar issue with Xamarin and Windows Phone,
or can anyone help to get my app into the Appstore?
Thanks.
I would have asked in the Xamarin Forum, but I cant reach them siche this morning.
And sorry for the engrish.
To submit package to the windows phone store you'll need to build your project (for ARM in Release mode to avoid warnings). Then on developer site when there is button to upload package you have to attach *.xap file from your project's bin\release folder (or bin folder you have specified). Then you can go through the next windows phone store app submitting steps.

Resources