Skip to content

Instantly share code, notes, and snippets.

@JonDouglas JonDouglas/snippets.md
Last active Jul 28, 2017

Embed
What would you like to do?
Xamarin.Android Troubleshooting Snippets

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
  1. Enable android:debugging="true" in you application or set your Configuration to Debug

  2. Set the debug.mono.log to timing to generate counters.txt and methods.txt files

https://developer.xamarin.com/guides/android/advanced_topics/environment/

https://developer.xamarin.com/guides/android/advanced_topics/environment/#debug.mono.log

https://developer.xamarin.com/guides/android/advanced_topics/environment/#Example

You can also use adb shell setprop debug.mono.log timing.

# Enable timing messages to be created
debug.mono.log=timing
  1. Take the counters.txt and methods.txt off the device
adb shell run-as com.myapplication.App1 cat files/.__override__/counters.txt > counters-FullAOT.txt
adb shell run-as com.myapplication.App1 cat files/.__override__/methods.txt > methods-FullAOT.txt
  • counters.txt - JIT diagnostics everytime Runtime.register() is invoked. Note: Typically you care about how much time is spent JITing. i.e. the Total time spent JITting (sec) value.
  • methods.txt - List of every method that is JIT'd in the order it is JIT'd. Note: Typically you care about how many lines methods.txt has in total. i.e. 1562 lines

Ensuring AOT is working

In adb logcat look for the following tag:

AOT: image '<ASSEMBLY NAME>.dll.so' found.

Otherwise you'll see an error similar to:

AOT: image '<ASSEMBLY NAME>.so' not found: dlopen failed: cannot locate symbol "__aeabi_memset" referenced by "/data/app/com.myapplication.App1-1/lib/arm/libaot-<ASSEMBLY NAME>.dll.so"...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.