Created attachment 14450 [details]
A release build of an Android app will still create a writeable “.__override__” directory in the app’s data directory. According to this post, the directory is supposed to be created only for debug builds, _not_ release.
I did some testing and this seems to be a regression in 6.0 and still in the latest alpha build since the issue doesn’t occur in 5.1: https://gist.github.com/jimmgarrido/59f80b59ea742c62091e
### Environment Info
=== Xamarin Studio ===
Version 5.10.1 (build 6)
Installation UUID: 94ce5106-6a72-4691-b34e-cd5857b1db66
Mono 4.2.1 (explicit/6dd2d0d)
GTK+ 2.24.23 (Raleigh theme)
Package version: 402010102
=== Xamarin.Profiler ===
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Apple Developer Tools ===
Xcode 7.2 (9548)
=== Xamarin.iOS ===
Version: 188.8.131.52 (Business Edition)
Build date: 2015-12-08 16:20:29-0500
=== Xamarin.Android ===
Version: 184.108.40.206 (Business Edition)
Android SDK: /Users/jimmygarrido/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.1 (API level 16)
4.4 (API level 19)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 22.0.1
Java SDK: /usr
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
=== Xamarin Android Player ===
Location: /Applications/Xamarin Android Player.app
=== Xamarin.Mac ===
Version: 220.127.116.11 (Business Edition)
=== Build Information ===
Release ID: 510010006
Git revision: 0b60eecdb531933734519c13257d16a780274aab
Build date: 2015-12-04 20:28:20-05
Xamarin addins: 9876fd7c9837977178411ec7375b4352c0a0d6af
Build lane: monodevelop-lion-cycle6-baseline
=== Operating System ===
Mac OS X 10.11.2
Darwin Jimmys-MacBook-Pro.local 15.2.0 Darwin Kernel Version 15.2.0
Fri Nov 13 19:56:56 PST 2015
> According to this post, the directory is supposed to be created only for debug
> builds, _not_ release.
> I did some testing and this seems to be a regression in 6.0
There's a difference between *log files* saying it's *looking* for a file there, vs. *the directory actually existing*.
1. Create new project (default template).
2. Set Configuration to Release
3. Build + Run
`adb logcat` contains:
> 01-05 16:58:33.098 25736 25736 W monodroid: Trying to load sgen from: /storage/emulated/0/Android/data/scratch.bxc37422/files/.__override__/libmonosgen-2.0.so
i.e. it's *looking* for a file in the `.__override__` directory.
> $ adb shell ls -l /storage/emulated/0/Android/data/scratch.bxc37422/files/.__override__
> /storage/emulated/0/Android/data/scratch.bxc37422/files/.__override__: No such file or directory
The directory doesn't exist.
> $ adb shell ls -l /storage/emulated/0/Android/data/scratch.bxc37422
> /storage/emulated/0/Android/data/scratch.bxc37422: No such file or directory
Nor does an app-specific external storage directory.
> 01-05 17:18:42.333 29613 29613 W monodroid: Trying to load sgen from: /data/user/0/scratch.bxc37422/files/.__override__/libmonosgen-2.0.so
> $ adb shell ls -a /data/user/0/scratch.bxc37422/files/.__override__
*That* is troubling; there's no error message. It therefore exists.
Additional analysis shows that the Debug runtime is being embedded into the app, which is *not* what should be happening.
Thank you for the report.
Enable diagnostic build output, and see:
> Mandroid Task
> Debug: True
That's not good. :-(
The Debug value is $(AndroidUseDebugRuntime).
Rebuild the app with the $(AndroidUseDebugRuntime) property set to False fixes the issue:
$ xbuild /p:Configuration=Release /p:AndroidUseDebugRuntime=False /t:SignAndroidPackage App.csproj
So a "workaround" exists, but it's a workaround that shouldn't be necessary.
The problem is in (either? both?) Xamarin.Android.Common.targets and the App.csproj file.
> <AndroidUseDebugRuntime Condition="'$(AndroidUseDebugRuntime)' == '' And '$(AndroidUseSharedRuntime)' == 'False' And '$(EmbedAssembliesIntoApk)' == 'True' And '$(DebugType)' != 'Full'" >False</AndroidUseDebugRuntime>
> <AndroidUseDebugRuntime Condition="'$(AndroidUseDebugRuntime)' == ''" >True</AndroidUseDebugRuntime>
The default App.csproj as generated by Xamarin Studio 5.10.1:
> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
We can manually walk through the //AndroidUseDebugRuntime/@Condition expression, and see that the first line will *not* be executed, i.e. $(AndroidUseDebugRuntime) will be True (the 2nd line), because $(DebugType) is Full. (Why is $(DebugType) defaulting to True?!)
Is this a recent Xamarin Studio change?
> Is this a recent Xamarin Studio change?
David Karlaš did some exploration, and it doesn't seem that Xamarin Studio has changed behavior here.
He suggests that we also check for '$(DebugSymbols)'=='True' in addition to (instead of?) '$(DebugType)'=='Full'.
Fixed in monodroid/master/532f5db7
I have reproduced this issue with stable XA 6.0.1-10. Here is the adb logcat for the same: https://gist.github.com/Abhishekk360/b4e1d2d718e023312697
I have checked this issue with master XA 18.104.22.168, C6 XA 22.214.171.124 and observed that now, ".__override__ " directory. is not exists in adb logcat, while build and run application in Release mode. Here is the adblogcat: https://gist.github.com/Abhishekk360/6d1e922f162aad67dbdf
Hence closing this issue.
Today, I have checked this issue with C6SR2 XA 126.96.36.199 and observed that ".override " directory. is not exists in adb logcat, while build and run application in Release mode.
Here is the adb logcat: https://gist.github.com/Abhishekk360/ca6368ebf6393801a823
Environment info: https://gist.github.com/Abhishekk360/a5b9b07d6cc082dc8311