From 048e671114d14b4bfad81e21aaebaf10e706a04e Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Mon, 19 Jun 2017 21:14:34 -0400 Subject: [PATCH] [Xamarin.Android.Build.Tasks] !Embed Assemblies == Debug Runtime Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=56485 Scenario: Create an app, then change `$(Optimize)` in the Debug configuration to be True, with `$(EmbedAssembliesIntoApk)`=False (default for Debug configuration). Build, deploy, run the app. Expected results: it works! Actual results: Not so much: F/monodroid: No assemblies found in '(null)' or ''. Assuming this is part of Fast Deployment. Exiting.. What went wrong is Commit 1e0e0834: making `$(Optimize)` *the* switch to control whether the Debug or Release runtime is used means that a "Debug" configuration with `$(Optimize)`=True is treated as requiring a *Release runtime*, which means the external assembly directory isn't used and doesn't exist. Attempt to address this by bringing `$(EmbedAssembliesIntoApk)` into the picture: if it's False -- i.e. fast deployment -- then it "overrides" the `$(Optimize)` value when it comes to the `$(AndroidIncludeDebugSymbols)` property. (The `$(AndroidIncludeDebugSymbols)` property controls whether the Debug or Release runtime is used. Yes, this name doesn't make sense.) This means for greater sanity we now need a truth table: Input Property: || Output Property DebugSymbols | DebugType | EmbedAssembliesIntoApk | Optimize || AndroidIncludeDebugSymbols ================+============+==========================+============++=========================== True *any* True True False (Release runtime) True *any* True False True (Debug runtime) True *any* False True True (Debug runtime) True *any* False False True (Debug runtime) True *empty* True True True (Debug runtime) True *empty* True False True (Debug runtime) True *empty* False True True (Debug runtime) True *empty* False False True (Debug runtime) False - - - False (Release runtime) Question: Should `$(DebugSymbols)` *truly* be the controlling factor, i.e. when `$(DebugSymbols)`=False the Release runtime is always used. Additionally, update `$(AndroidUseDebugRuntime)` so that it also takaes `$(EmbedAssembliesIntoApk)` into consideration. --- .../Xamarin.Android.Common.targets | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 84c8bce13ab..b5ca2b3f284 100755 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -188,7 +188,9 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. False False - False + False True True @@ -265,7 +267,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. - + True