Skip to content

Instantly share code, notes, and snippets.

👷
Working on something great!

Jon Douglas JonDouglas

View GitHub Profile
@JonDouglas
JonDouglas / snippets.md
Last active Jul 28, 2017
Xamarin.Android Troubleshooting Snippets
View snippets.md

Diagnosing JIT / AOT Timings

  1. After installing the .apk, open up an Android Device Monitor to the Logcat tab, or use adb logcat
  2. Look for a log under ActivityManager that has the message Displayed Activity: <timing>

EX:

07-28 12:48:38.356: I/ActivityManager(769): Displayed com.myapplication.App1/md58adf3f2592a7497b73592b5e766304c2.MainActivity: +1s990ms
View Activity1.cs
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using LoginScreen;
View whatthreadami.cs
Thread uiThread;
uiThread = Thread.CurrentThread; //Ensure this is called during a Main/UI thread call
void WhatThreadAmI([CallerMemberName] string method = "", [CallerLineNumber] int line = 0)
{
Console.WriteLine("=========================");
Console.WriteLine("=========================");
Console.WriteLine("=========================");
Console.WriteLine($"{method} - {line}" {IsMainThread}");
View versions.md
Code Name Version API Level Release Date
None 1.0 1 2008-09-23
None 1.1 2 2009-02-09
Cupcake 1.5 3 2009-04-27
Donut 1.6 4 2009-09-15
Eclair 2.0-2.1 5-7 2009-10-26
Froyo 2.2-2.2.3 8 2010-05-20
Gingerbread 2.3-2.3.7 9-10 2010-12-06
Honeycomb 3.0-3.2.6 11-13 2011-02-22
@JonDouglas
JonDouglas / systemapp.md
Created Mar 10, 2016
Xamarin.Android Install as System Application
View systemapp.md

Xamarin.Android Installing APK as System Application

Ideally if you took a Release .apk, anything in the lib/ABI should go into the respective /system/lib folder.

For example with a File->New Android Project

If I created a Release Aligned .apk, I should be able to extract it and view the following:

lib\armeabi-v7a

@JonDouglas
JonDouglas / xamarin-android-nuget-m2repository-issues.md
Last active Aug 19, 2016
xamarin-android-nuget-m2repository-issues
View xamarin-android-nuget-m2repository-issues.md
@JonDouglas
JonDouglas / xamarin-android-performance.md
Last active Jan 29, 2019
Xamarin Android Performance
View xamarin-android-performance.md

Xamarin.Android Performance Issues

1. Investigation

One of the best ways to investigate a problematic Xamarin.Android Errors is to first ensure you have the proper tooling available:

  • Diagnostic MSBuild Output Enabled(Instructions)
  • Android SDK Installed
  • Android API Level Documentation
@JonDouglas
JonDouglas / xamarinandroidbindings.md
Last active Apr 22, 2019
Xamarin Android Bindings Troubleshooting
View xamarinandroidbindings.md

Approaching a Xamarin.Android Bindings Case

1. Investigation

One of the best ways to investigate a problematic Xamarin.Android Binding is to first ensure you have the proper tooling available:

View gist:061d9082a6727c53be6f
<Application
x:Class="UpgradeTest.WinPhone.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
<!--Application Resources-->
<Application.Resources>
<local:LocalizedStrings xmlns:local="clr-namespace:UpgradeTest.WinPhone" x:Key="LocalizedStrings"/>
View gist:7072f27543921c06b5be
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using UpgradeTest.Renderers;
using UpgradeTest.WinPhone.Renderers;
You can’t perform that action at this time.