Xamarin.Android immediately terminates - xamarin

Can someone please explain what's going on with my newly created Xamarin Xaml Portable project? When in "Debug" the application terminates immediately as soon as I lunch it -- like the gif above.
When in Release, it runs -- like the gif below
I like to understand what's going on between Debug and in Release why when in Debug, it terminates immediately but not in Release.
My phone model is Oppo A37F - Android 5.1
Another confusion is that, I have a Samsung Galaxy S DUOS 2, that is flashed with a custom fimrware - Android 6 (Marshmallow) - I am not facing the Debug/Release issue with this one.
Turning off/on my PC and Android devices does not help as well.
Thank you

and so I got it to work. Thanks #Smit for the direction
I have to set "Sdk Assemblies Only" in Debug.. The default setting is set to "None"

Clean your solution then uninstall the application on your device or emulator
and deploy your solution, that solved my problem.

Related

Error: there were deployment errors

When I tried to run any sample application or a new one it shows this error. Can anyone help please?
The error is telling you that you have not selected a device:
"Please select a valid device before running the application"
You need to choice a physical phone (or Android emulator) to deploy the application to.
Ref: Debug on Device
you have to have the android virtual device downloaded.
here are a few options:
Xamarin Android player
Bluestacks
Andy
Genymotion
Now that you have the virtual device. you need to start one before you run or debug.
The specific error you are seeing is because you've not started the device properly before you debug, you should be able to see the device.
Now run the project, and you wont meet this error.
This is because of Hyper V. Things you need to do are:
1.Turn off your Hyper V.(http://www.poweronplatforms.com/enable-disable-hyper-v-windows-10-8/)
2.Update your android SDK to desired platform.
That set. Now run your app. It will work.
Please let me know if still you have same error.
I would advise you to use the Visual Studio Emulator for Android (get it here), it plays very nice with Xamarin and Visual Studio and sets up your system automatically. As an added benefit it is very fast!

Xamarin.Forms application properties not saved between sessions with Android

In my cross-platform app I save application properties in the following way:
Application.Current.Properties["myValue"] = "Test";
await Application.Current.SavePropertiesAsync();
I then retrieve them later like this:
string myVal = Application.Current.Properties["myValue"];
This works perfectly when using the Android emulator. I can close the emulator down, and when I restart it again, my app data is preserved.
However, when I deploy this app to a physical Android device, data preservation works as expected until I close the app and open it again. At this point I retrieve an empty value. It's as though the data is only saved to memory (and not to file).
Furthermore, the iOS version of the exact same app works faultlessly. When I open the app up, all previous values have been saved and I can retrieve them.
What am I doing wrong on the Android version? Is there an Android setting, permission, or option which I need to enable to have the values saved between app sessions when actually deployed to a phone?
I had a similar problem where only the debug version saved Properties. I think we're still waiting for the bug fix, and this is the workaround on Xamarin Forms bugzilla.
In short: go to .Droid project settings -> Android Options -> Linker
and enter/add "System.Runtime.Serialization" to Skip linking assemblies.
Wow! After lots of research, I have getting solution for same issue in mine. Problem is that, when i store List or DataTable in Application.Current.Properties then all properties are removed after reopen app but if i store List or DataTable as serialize, it working fine.
In VS you need to enable the option:
Preserve application data/cache on device between deploys
You can find this at Tools > Options > Xamarin > Android Settings.
I don't know if this has stopped in the latest updates of Xamarin Forms, the data is available until the application is running similar to session but persistent storage does not work.
The best api I think available for this is Akavache https://github.com/akavache/Akavache.
You can read this blog https://codemilltech.com/akavache-is-aka-awesome/.
Update
There is a bug filed in bugzilla:
https://bugzilla.xamarin.com/show_bug.cgi?id=26444
I don't remember exactly which part of this solved the issue, but when I followed the instructions to prepare the Android application for release from start to finish, the issue went away. The problem occurred when debug builds were used on an Android device.
https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/publishing_an_application/part_1_-_preparing_an_application_for_release/
The link details the suggested settings for the Android project when releasing to device. Following these instructions should solve the issue.

(Xamarin) WinPhone app won't start

I'm working on a project using Xamarin to build an app for WinPhone and Android.
On the Android device, it works fine.
When I try to run the app on the WinPhone device, the app starts opening and then it closes. On the console I see "TaskHost.exe has exited with code 0."
I don't see any error.
A guy that was working on it before, was using the WinPhone device without problems.
When I started working on it, the only thing I needed to change was the SQLite.WP80 version. He was using 3.8.7.1 and my VS only provided 3.8.8.1.
Has anyone faced a similar problem?
Or how can I see what is wrong? In the console output there is no errors.
I've added a breakpoint in the begining of WinPhone, but it doesnt't arrive there.
Thanks in advance!
Have you changed your namespace? Check if the startup object in the project setup is set accordingly.
Finally I found the problem.
By returning the code revision, I found one where the WinPhone project was working on phone.
Then, I started looking for differences.
Someone renamed AppWP.xaml to AppWinPhone.xaml.
Then, on project properties > startup object, it was blank.
I just set the object back and it worked.
(Why not an error message saying what is wrong...)
Thanks!

iOS Today View Not Running on Device

I have created my first Today View extension that just displaying some texted it retrieves from a shared NSUserDefaults. It works perfectly and is ready to be shipped based off of how it displays and works through simulator, but when I try to run it on my device nothing happens.
The widget shows up in notification center but it has no height. I run my main app from Xcode and it wont let me attach the debugger to it and none of my breakpoints, nslogs get hit.
I tried running the Today View target on device and I can't get the provisioning profiles to be accepted. I also tried attaching the process of the today view to the debugger with the full bundle ID and it never attaches no matter wether I open notification center or not.
Im very new with extensions and have searched a ton around for an answer to this but cant find anything that worked.
Any help would be greatly appreciated, thanks.
and in my case i tested on SDK 8.2 and my test device running on 8.1.1 totally forgotten about Deployment target changing to 8.0 worked like charm..Might be helpful for the one careless like me..
For anyone that may stumble upon this all I had was add arm64 to the list of acceptable architectures and it worked
In your widget build settings set the architectures to armv7, arm64
see this post iOs today extension do not launch - lost connection to device

Console Logging gone in TitaniumStudio

***Project Specs:***
iOS 4.3
Ti SDK 1.6.2
Titanium Studio
I've recently switched to Titanium Studio from Titanium Developer and after importing my project any references to Ti.API.info('some message') are completely ignored.
I searched the Appcelerator Q/A forums but all I found were people having the problem but no solution or reason.
did you check your run configurations
to make sure logging is turned on?
also i am pretty certain you have to
be using at least 1.7.x to use
TiStudio, i might be wrong about that
though
TiStudio has multiples consoles running at the same time. To access them you need to be using Debug mode with 1.7.* or you can just click the small console icon multiple times to shuffle through each Kroll function console running.
In the picture in this guide it's the fourth button from the right. The blue one.

Resources