Commit 318dd7e
[Xamarin.Android.Build.Tasks] No .dll's in Release if Optimize != True (#749)
Context: https://bugzilla.xamarin.com/show_bug.cgi?id=58580
Unable to locate assemblies when running projects when
`$(Configuration)`=Release and `$(Optimize)` != True.
Commit edabe8a reworked the build logic so that `$(Optimize)`
controls the deployment of the debug or release runtimes.
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)
*empty* *any* *empty* False True (Debug runtime)
In this scenario, `$(DebugSymols)` and `$(EmbedAssembliesIntoApk)` are both empty.
As a result `$(EmbedAssembliesIntoApk)` gets a default value of 'False'.
But because `$(DebugSymols)` is empty we fall through the MSBuild case statement
and end up with `$(AndroidIncludeDebugSymbols)` = `True`. Which is NOT what we want in this case.
So if `$(EmbedAssembliesIntoApk)` we should always default `$(AndroidIncludeDebugSymbols)`
to false.
In addition there was a weird issue with the way we install debug apps.
If the app is using the Shared Runtime the deployment process sends a
broadcast to the Shared Runtime app which returns the external storage
directory. This tends to be something like
/mnt/shell/emulated/0/
So when we deploy our debug assemblies we do so to a directory like
/mnt/shell/emulated/0/Android/data/$(PackageName)/files/.__override__
This works as expected. Now if we try to debug an app without using the Shared
Runtime it will work as expected.. unless the Shared Runtime was not installed.
In this case the broadcast fails and we fall back to getting the external storage
using
adb shell echo -b ${EXTERNAL_STORAGE}
This returns
/mnt/shell/emulated/legacy
so we end up deploying the debug assemblies to
/mnt/shell/emulated/legacy/Android/data/$(PackageName)/files/.__override__
So all is well and good. However problems start in our runtime and the
MonoPackageManager. We use
android.os.Environment.getExternalStorageDirectory ();
to get the external storage directory. In this case it ALWAYS returns
/mnt/shell/emulated/0/
So if we are debugging without the Shared Runtime being installed, we will
NEVER find the fast deployed assebmies. So the app will crash. The fix in
this case is to check both directories when we are running the debug
runtime.1 parent 993f540 commit 318dd7e
File tree
6 files changed
+42
-13
lines changed- src
- Mono.Android/java/mono/android
- Xamarin.Android.Build.Tasks
- Resources
- monodroid/jni
6 files changed
+42
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
| |||
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
52 | | - | |
53 | | - | |
54 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
55 | 63 | | |
56 | 64 | | |
57 | 65 | | |
| |||
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
| |||
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
52 | | - | |
53 | | - | |
54 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
55 | 63 | | |
56 | 64 | | |
57 | 65 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
282 | 287 | | |
283 | 288 | | |
284 | 289 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | | - | |
| 332 | + | |
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
| 413 | + | |
413 | 414 | | |
414 | 415 | | |
415 | 416 | | |
| |||
651 | 652 | | |
652 | 653 | | |
653 | 654 | | |
| 655 | + | |
654 | 656 | | |
655 | 657 | | |
656 | 658 | | |
| |||
2512 | 2514 | | |
2513 | 2515 | | |
2514 | 2516 | | |
| 2517 | + | |
2515 | 2518 | | |
2516 | 2519 | | |
2517 | 2520 | | |
| |||
3893 | 3896 | | |
3894 | 3897 | | |
3895 | 3898 | | |
3896 | | - | |
| 3899 | + | |
3897 | 3900 | | |
3898 | 3901 | | |
3899 | 3902 | | |
| |||
3923 | 3926 | | |
3924 | 3927 | | |
3925 | 3928 | | |
3926 | | - | |
| 3929 | + | |
3927 | 3930 | | |
3928 | | - | |
| 3931 | + | |
| 3932 | + | |
| 3933 | + | |
| 3934 | + | |
| 3935 | + | |
3929 | 3936 | | |
3930 | 3937 | | |
3931 | 3938 | | |
| |||
3937 | 3944 | | |
3938 | 3945 | | |
3939 | 3946 | | |
| 3947 | + | |
3940 | 3948 | | |
3941 | 3949 | | |
3942 | 3950 | | |
| |||
0 commit comments