Bug 40827 - Apps deployed without runtime profiler in 6.1.99
Summary: Apps deployed without runtime profiler in 6.1.99
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 6.0.99
Hardware: PC Mac OS
: Normal normal
Target Milestone: 7.0 (C8)
Assignee: Jonathan Pryor
: 41810 ()
Depends on:
Reported: 2016-05-03 14:51 UTC by Rodrigo Moya
Modified: 2016-08-01 18:44 UTC (History)
7 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Rodrigo Moya 2016-05-03 14:51:17 UTC
Run->Start profiling is available, and apps gets built and deployed to simulator/device, profiler is started, but then the profiler UI never gets any data from the app, as the runtime libs are not included:

05-03 16:44:23.545 W/monodroid( 1237): Trying to load profiler: /data/data/com.xamarin.XamStore/files/.__override__/libmono-profiler-log.so: dlopen=0x0 error=No such file or directory
05-03 16:44:23.545 W/monodroid( 1237): Trying to load profiler: /data/app/com.xamarin.XamStore-1/lib/x86/libmono-profiler-log.so: dlopen=0x0 error=No such file or directory
05-03 16:44:23.545 W/monodroid( 1237): looking for embedded profiler within '/data/app/com.xamarin.XamStore-1/lib/x86/libmonodroid.so': dlopen=0xaf14834c error=<none>
05-03 16:44:23.545 W/monodroid( 1237): Looking for profiler init symbol 'mono_profiler_startup_log'? 0x0
05-03 16:44:23.545 W/monodroid( 1237): Trying to load profiler: /data/app/Mono.Android.DebugRuntime-1/lib/x86/libmono-profiler-log.so: dlopen=0x0 error=No such file or directory
05-03 16:44:23.545 W/monodroid( 1237): The 'log' profiler wasn't found in the main executable nor could it be loaded from 'libmono-profiler-log.so'.

Xamarin.Android itself seems to do the correct thing, so it looks like a bug in XS, which is building the app without profiling support when it should.

=== Xamarin Studio Business ===

Version 6.1 (build 817)
Installation UUID: 0a9ae72a-48a9-4853-ab6a-fe231f5fca0b
	Mono 4.4.0 (mono-4.4.0-branch/fcf7a6d) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404000148

=== NuGet ===


=== Xamarin.Profiler ===

Version: 0.33.99
Location: /Users/rodrigo/Projects/xamarin/profiler/src/XamarinProfiler.Mac/bin/Debug/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Version: (Xamarin Business)
Android SDK: /Users/rodrigo/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)
		6.0.99 (API level 24)

SDK Tools Version: 25.1.3
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 23.0.3

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Android Designer EPL code available here:

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.3 (10183.3)
Build 7D175

=== Xamarin.Mac ===

Version: (Xamarin Business)

=== Xamarin.iOS ===

Version: (Xamarin Business)
Hash: 3afb4af
Branch: master
Build date: 2016-04-24 15:13:41-0400

=== Build Information ===

Release ID: 601000817
Git revision: 2335763551f9db8296b08542035977b899b7f3b7
Build date: 2016-04-25 10:45:36-04
Xamarin addins: 7f8c9ab2a981143a87fbd5adbde3f5890a838fde
Build lane: monodevelop-lion-cycle8-preview

=== Operating System ===

Mac OS X 10.11.4
Darwin cogulla.local 15.4.0 Darwin Kernel Version 15.4.0
    Fri Feb 26 22:08:05 PST 2016
    root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
Comment 1 Jonathan Pryor 2016-05-03 17:57:00 UTC
Diagnostic build output is at:


.apk contents are at:


Cursory glance suggests that the `$(AndroidEmbedProfilers)` MSBuild property is not set, so when BuildApk.AddProfilers() executes, it doesn't do anything, so the profiler libs aren't added to the .apk.
Comment 2 Peter Collins 2016-05-04 20:44:22 UTC
Does this only affect Master/C8 6.1.99? Or is this behavior also reproducible in the current C7 Beta 6.1.0.x?
Comment 3 Rodrigo Moya 2016-05-05 09:57:14 UTC
I've only seen it in latest alpha channel packages, so C7?
Comment 4 Jonathan Pryor 2016-05-05 12:33:58 UTC
@Moya: Current alpha channel is "C8 preview." *Beta* channel is C7.

As of 2016-April-27, anyway.

Prior to that point, the alpha channel had C7.
Comment 5 dean.ellis 2016-06-14 08:46:52 UTC
The inclusion of the profiler will depends on a few factors

1) The value of $(AndroidEmbedProfilers) 
2) If it is a debug build 

A debug build in this case is if $(AndroidIncludeDebugSymbols) is true. That gets set to true if 

a) $(DebugSymbols) = true
b) $(DebugType) = 'Full' or ''

now if it is a debug build and $(AndroidEmbedProfilers) is empty it will default to 'log'. 

So if you are trying to profile a Release build you will need to set $(DebugSymbols) and $(DebugType) to the appropriate values or set $(AndroidEmbedProfilers).

I am not sure of the profiler requires some of the debug info or not. I am also not 100% sure if this is how we want it to work. Do we want to be able to profile full release apps?
Comment 6 Rodrigo Moya 2016-06-14 09:51:20 UTC
Right now we only support profiling debug builds
Comment 7 Rodrigo Moya 2016-06-16 15:57:38 UTC
*** Bug 41810 has been marked as a duplicate of this bug. ***
Comment 8 Jonathan Pryor 2016-07-01 02:46:17 UTC
Is this still an issue? With a local monodroid/5455dd5e build (2016-June-30), samples/Hello contains libmono-profiler-log.so:

> $ unzip -l samples/Hello/bin/Debug/*-Signed.apk | grep libmono-pro
>    655252  06-30-16 20:27   lib/x86/libmono-profiler-log.so
>    734196  06-30-16 20:27   lib/armeabi/libmono-profiler-log.so
>    705676  06-30-16 20:27   lib/armeabi-v7a/libmono-profiler-log.so

Additionally it is installed on-device:

> $ adb shell ls -l /data/app/Mono.Samples.HelloTests-1/lib/arm | grep profi
> -rwxr-xr-x system   system     705676 1979-12-31 20:27 libmono-profiler-log.so

The profiler *should* work now. Is this still a problem?
Comment 9 Rodrigo Moya 2016-07-08 16:52:24 UTC
The profiler still doesn't work on master/C8 builds, but with master builds (xamarin.android-6.1.99-375.pkg) the runtime profiler is included in the APK, so this one is fixed now
Comment 10 asimk 2016-07-12 19:50:21 UTC
Unable to verify this issue due to bug https://bugzilla.xamarin.com/show_bug.cgi?id=42500
Comment 12 abhi 2016-08-01 18:44:29 UTC
I am also checked this issue latest master build:xamarin.android-6.1.99-415
and observed that this issue is working fine.

Environment Info:https://gist.github.com/atin360/750a8aecc3edae5b2116fc0ba659661e

Screencast: http://www.screencast.com/t/PxdFzLrx