Bug 54217 - Application installed in Internal storage even after setting installation target as External storage in Android manifest.
Summary: Application installed in Internal storage even after setting installation tar...
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 7.2 (15.1)
Hardware: PC Windows
: --- normal
Target Milestone: master
Assignee: Jonathan Pryor
: 53892 53893 ()
Depends on:
Reported: 2017-03-29 13:30 UTC by Swati Gangrade
Modified: 2017-10-23 14:46 UTC (History)
9 users (show)

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

Log (55.26 KB, application/octet-stream)
2017-03-29 13:30 UTC, Swati Gangrade
emulator Image (48.26 KB, image/png)
2017-03-30 05:26 UTC, Swati Gangrade
Simulator Details (16.10 KB, image/png)
2017-03-31 09:28 UTC, Saurabh Paunikar

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 for Bug 54217 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Swati Gangrade 2017-03-29 13:30:45 UTC
Created attachment 21016 [details]

Build Environemnt:-
•	Xamarin (80d9a02)
•	Xamarin.Android (b16fb82)
•	Xamarin.iOS (7656cc6)

Steps to reproduce : 

1.Create a sample Android app.
2.Navigate to the solution/Project -> properties ->Android Manifest file and select "Prefer External" for the Install location drop down.
3.Build and deploy application on an emulator that has an SD card storage available with sufficient space.

Emulator Info. : 
Android emulator with Marshmallow(6.0.0) Android 6 API level 23

Expected : 
Application should get installed in external storage.

Actual : 
Application is getting installed in internal storage.

Reproducible : 10/10 

All logs and Screenshot are attached with this bug.

Detailed Log-1>Starting deploy 5" Marshmallow (6.0.0) XHDPI Phone ...
1>Deploying 5" Marshmallow (6.0.0) XHDPI Phone ...
1>Build started.
1>Project "App56.csproj" (Install target(s)):
1>sdk   Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory found:
1>    Path contains adb in \platform-tools (C:\Program Files (x86)\Android\android-sdk).
1>sdk   Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory found:
1>    Path contains ndk-stack in \. (C:\ProgramData\Microsoft\AndroidNDK\android-ndk-r11c\).
1>sdk   Key HKCU\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory found:
1>    Path contains jarsigner.exe in \bin (C:\Program Files\Java\jdk1.8.0_121).
1> Found Android SDK. API levels: 19, 21, 22, 23
1>  PackageName: App56.App56
1>Skipping target "_GenerateAndroidAssetsDir" because it has no outputs.
1>MonoAndroid Tools: C:\Program Files (x86)\MSBuild\Xamarin\Android\
1>MonoAndroid Binaries: C:\Program Files (x86)\MSBuild\Xamarin\Android\
1>Android Platform API level: 23
1>TargetFrameworkVersion: v6.0
1>Android NDK: C:\ProgramData\Microsoft\AndroidNDK\android-ndk-r11c\
1>Android SDK: C:\Program Files (x86)\Android\android-sdk\
1>Android SDK Build Tools: C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.1\
1>Java SDK: C:\Program Files\Java\jdk1.8.0_121\
1>Dex Fast Deployment Enabled: False
1>Android Java Class for Fast Deployment: 
1>Application Java class: android.app.Application
1>Skipping target "_ResolveLibraryProjectImports" because all output files are up-to-date with respect to the input files.
1>Skipping target "_BuildLibraryImportsCache" because all output files are up-to-date with respect to the input files.
1>Skipping target "_BuildAdditionalResourcesCache" because all output files are up-to-date with respect to the input files.
1>Skipping target "_CreateAdditionalResourceCache" because it has no outputs.
1>Skipping target "_GenerateAndroidResourceDir" because all output files are up-to-date with respect to the input files.
1>Build target ABI: arm64-v8a;armeabi;armeabi-v7a;x86;x86_64
1>Skipping target "_UpdateAndroidResgen" because all output files are up-to-date with respect to the input files.
1>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1>C:\Program Files (x86)\MSBuild\14.0\bin\csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE;__XAMARIN_ANDROID_v1_0__;__MOBILE__;__ANDROID__;__ANDROID_1__;__ANDROID_2__;__ANDROID_3__;__ANDROID_4__;__ANDROID_5__;__ANDROID_6__;__ANDROID_7__;__ANDROID_8__;__ANDROID_9__;__ANDROID_10__;__ANDROID_11__;__ANDROID_12__;__ANDROID_13__;__ANDROID_14__;__ANDROID_15__;__ANDROID_16__;__ANDROID_17__;__ANDROID_18__;__ANDROID_19__;__ANDROID_20__;__ANDROID_21__;__ANDROID_22__;__ANDROID_23__ /errorendlocation /preferreduilang:en-US /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Java.Interop.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\Mono.Android.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.Linq.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\Microsoft.Win32.Primitives.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\Microsoft.Win32.Registry.AccessControl.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\Microsoft.Win32.Registry.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.AppContext.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Collections.Concurrent.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Collections.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Collections.NonGeneric.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Collections.Specialized.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ComponentModel.Annotations.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ComponentModel.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ComponentModel.EventBasedAsync.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ComponentModel.Primitives.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ComponentModel.TypeConverter.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Console.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Data.Common.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Data.SqlClient.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Diagnostics.Contracts.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Diagnostics.Debug.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Diagnostics.FileVersionInfo.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Diagnostics.Process.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Diagnostics.StackTrace.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Diagnostics.TextWriterTraceListener.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Diagnostics.Tools.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Diagnostics.TraceEvent.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Diagnostics.TraceSource.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Diagnostics.Tracing.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Drawing.Primitives.dll" /reference:"C:\Program..
Comment 1 Swati Gangrade 2017-03-30 05:26:33 UTC
Created attachment 21035 [details]
emulator Image
Comment 2 Neeraj Deshmukh 2017-03-30 15:11:09 UTC
Adding target milestone as 15.1
Comment 3 Peter Collins 2017-03-30 16:40:58 UTC
I'm confused as to why we've reported three bugs to track this issue. It potentially makes sense to separate XS and VS environments into separate bugs if the behavior manifests differently, but that is unclear from the report. I am going to resolve the other bugs as duplicates of this one.
Comment 4 Peter Collins 2017-03-30 16:41:10 UTC
*** Bug 53893 has been marked as a duplicate of this bug. ***
Comment 5 Peter Collins 2017-03-30 16:41:21 UTC
*** Bug 53892 has been marked as a duplicate of this bug. ***
Comment 6 Peter Collins 2017-03-30 17:45:20 UTC
@Swati can you share the details of the emulator you're using? I see a similar behavior with an x86 API 25 emulator, however a java project which prefers an external installation location is also installing to internal storage in my case. Unfortunately this declaration is not guaranteed, external storage will not always be used when preferred.

I am not sure this is a bug in XA per-say, and from what I can tell it is also not a behavioral regression in recent XA builds. Do you have any physical devices with an SD card which you can test this scenario with?
Comment 7 Saurabh Paunikar 2017-03-31 09:28:32 UTC
Created attachment 21088 [details]
Simulator Details

Test suite-> [15.1] Scoped Mobile Regression Testing

Test Case->T10818716-Ensure application which enables fast deploy can be installed to external storage (Windows | VS2015/13)

Test Case URL https://testrail.xamarin.com/index.php?/tests/view/10818716

In test case there is a pre-requiiste which says that we need to emulator with SD Card configured. So we used simulator rather than device.
Comment 8 Saurabh Paunikar 2017-03-31 09:30:36 UTC
@Peter Needed info is provided. Kindly let me know if you any more details
Comment 11 Jon Douglas [MSFT] 2017-07-06 16:55:30 UTC
Another sanity test here would be to create a similar sample application in Android Studio and change the manifest to the similar preferExternal.


I went ahead and tested some similar scenarios based on these comments and the same behavior happens with both Xamarin and Android Studio. I believe that the issue here is that although the emulator shows an SD card, it is not treated as an external SD card.

Since the emulator creates a virtual SD card, the behavior is a bit different as there are two modes: portable and internal.

Portable allows for non-app files such as images, music, etc.

Internal allows for an extension of the internal storage.

So the emulators don't really act in the fashion of having an external SD card. It does allow you to move apps to the virtual SD card, in which it will show the app as external, but at installation time it doesn't seem to treat this SD card as external. This happens in Android Studio as well.

Thus I don't believe this is a bug and it will require someone to test with a physical device that has external storage as most Android devices now-a-days do not have external storage. Thus marking this issue as NEEDINFO until we can get a reproduction on a physical device with an external SD card for storage.