I'm using Maui preview (now release candidate) with a blazorwebview, to build a fairly simple app which connects to a webservice and synchronises data.
The windows and Android versions flew by. The iOS version has been a long slog. After upgrading my Mac (and a long list of workarounds) I was finally able to get some builds to deploy via testflight.
In the iOS version emulator works fine, but on a real device its throwing up a weird error parsing JSON (when doing a deserialise - I'm using newtonsoft) "error setting value to MyProp on MyObject" (names changed).
After much faffing, I got it debugging on a device and it worked fine. So that drew me to the conclusion that it must be a release optimization issue (it wasn't loading all my classes so deserialise fails).
However, no matter what linker settings I changed in the csproj file (full, sdkonly etc) the release build doesn't work. I could see the package size going up and down with these changes so they were obviously working. I've now deployed the debug version via testflight and it's working fine.
In my mind if the linker settings are the same then debug Vs release builds should be the same, but there is obviously a difference.
The release version of the package always seems to be double the size of debug (which is replicated with the different linker settings, ie sdkonly release is double sdkonly debug), so it looks like it's storing two builds in the release package?
Also when building in release mode it takes about 15minutes to build and in debug about 3.. so there must be significant difference I'm missing. Can anyone explain?
Related
I have written a Xamarin.Forms application and now I want to deploy the UWP project to the store but I can't create app packages.
When using Microsoft.NetCore.UniversalWindowsPlatform 6.2.2 or 6.2.0-preview I
in release mode, I constantly get this error :
Payload contains two or more files with the same destination path 'System.Runtime.CompilerServices.Unsafe.dll'. Source files:
C:\Users\john.nuget\packages\runtime.win10-x86-aot.microsoft.netcore.universalwindowsplatform\6.2.0-preview1-26926-04\runtimes\win10-x86-aot\lib\uap10.0.15138\System.Runtime.CompilerServices.Unsafe.dll
C:\Users\john.nuget\packages\system.runtime.compilerservices.unsafe\4.5.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll OfflineCurrencyConverter.UWP
But I followed the answer to this GitHub issue saying I should downgrade the package to 6.1.9.
Doing this causes my application to build for ever... the build never stops.
But when I disable .NET Native Tool chain, it builds and run in release mode but packages can't still be created. Please does anyone have a solution ? I'm frustrated.
I feel wasted building a whole app and realizing it can't be packaged at the end for this UWP project.
If it took way longer than you expected to build in release mode, use nuget version of .net native by installing Microsoft.Net.Native.Compiler package on nuget in your project and re-build it as usual. This solution solves the very same problem you have now in my experience.
Building app for .NET Native in release mode can take a very long time. It can even take as much as 10 minutes for larger apps. So make sure to give the compiler the time it needs. It might seem it is building forever, but it should definitely finish.
I need some help figuring out what the problem is.
I have a brand new installation of VS2017 fully updated
When I run my app in debug mode it works, when I run the app in release mode it would just hung at the splash screen, I tried to check the device log but I can only see IlligalStateException
I changed the Java Heap to 1G, but it did not solve the problem
I am upgraded to Xamarin.Forms 3.0 and I am compiling using Android 8.1, that did not solve the problem (also tried to lower the version)
I set the Linking to None, that only increased the app size and did not solve the problem
When I uncheck the "Bundle assemblies into native code" it then works but I have always been compiling my apps with this. (and it works in debug mode)
I checked the version of the NDK it is currently set to "C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r15c" Not sure if the version is incorrect that I am using since this is also a new laptop (my other laptop was stolen where everything compiled and worked perfectly)
It also seem that the Device Log is lagging and doesn't want to filter. Device Monitor seems to be crashing aswell.
I just tried to upgrade to nds-16 but that didn't work aswell.
For now I am compiling without it but I would like to compile with it again
Try first uninstall your app:
adb uninstall <your.package.name>
Maybe you use a different keystore for the signing.
You can set the log verbosity to diagnostic in order that you see the problem:
Tools/Options/Xamarin/Xamarin Diagnostic Output verbosity
Tools/Options/Projects and Solutions/Build and Run/ output verbosity
I am using Unity to build an Xcode project which is then used to build to a device for testing. The other devs can build just fine and we use Source Tree to interact with our Git.
So... for some reason, even though both Unity and Xcode throw no compile errors and successfully build the app (precisely: the Xcode project, then the App) when I launch the App it throws a generic connection error (cannot connect to server, check your internet connection).
We are trying to eliminate the culprit (if there is indeed just one) - but strangely, using the same Unity player settings and Xcode settings (as far as we can tell) - all the other devs can build just fine and do not receive this connection error. The device themselves work fine, and connect through an App built from someone else's machine, but if I build it from my Mac, it does not work.
Possibly relevant info: Unity and Xcode are both pretty fresh installs as I haven't used them before starting at this company. Not sure if Xcode or Unity (or both) are overwriting certain project specifics pulled from our Git?
Edit: this was a versioning issue, and my minor version increase was enough to cause it. Lesson learned: always make sure you are running the exact same version of any shared IDE / Engine.
I almost forgot about this question... I solved this by uninstalling the latest version of Unity and then installing the version the other developers were using.
I am not sure what version of Unity I was using at the time of writing - good learning: always post the version of the programs in question. But I do remember it was only a minor update in front of the others. Some small bug fix which ended up causing this connection error.
To anyone else experiencing this problem - if you are having trouble troubleshooting builds and only getting errors from your local machine: make 100% sure you are using the exact same versions of XCode and Unity.
I'm currently having a issue with Mono for Android.
In my application I'm currently saving my variables between sessions using SharedPreferences.
Now whenever I have changed any of the XML or AXML files since the last build, the compiler will rebuild my entire project (clean->build). The deployment of the app will therefore always do the "Removing previous version" step first , be it on a emulator or a Android device. This will also remove all variables in the SharedPreferences class, resulting in having to reinitialize those pieces of data, which becomes very tedious if I'm working on the XML files.
Is there any way to prevent that the project will be rebuild if the XML files are modified. Or is there any way to prevent the SharedPreference data from being removed if the application gets re-installed?
Extra info:
Build target: API 10
Mono for Android Version:4.2.3
IDE: Visual Studio 2010 Ultimate SP1
Emulator: API 10 Atom x86 default emulator
Device: Samsung Galaxy Wonder (Android 2.3.3)
A rebuild is necessary when resource files change since it can result in a change to the generated Resource class. That said, Mono for Android does provide an option to preserve application data between deploys to help in situations like this.
If you look under Options-> Mono for Android you'll see a checkbox labeled "Preserve application data/cache on device between deploys" to turn on this feature.
Well, I'm getting started in applications android development, as I'm familiar with C#.NET(and I love it), I decided to use the fantastic MonoDroid project. I downloaed and installed,worked fine until now. I created hello world application, using MonoForAndroid_API_8 emulator device, worked fine.
then I copied *.apk files and installed in my tablet with android OS 2.2, but when I run my application,I get the following error:
The xx.xx application (xx.xx process) stopped unexpectedly. Try again.
how to fix this? Any help is very appreciated. Thanks in advance.
You can find information here about how to view the Android logs.
I'll take a guess at what your problem is though, without having seen the logs. Are you using the full version of Mono for Android or the evaluation? The eval doesn't support deploying to an actual device.
If you are on the full version, is the APK from a debug build or release? Debug builds are made to use a shared runtime to make deployments quicker, but it means that the APK doesn't contain everything the app needs to run. Release builds don't use the shared runtime, so the Mono runtime is bundled with the APK.