Bug 58802 - Signed APK install path not public
Summary: Signed APK install path not public
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 7.3 (15.2)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: dean.ellis
Depends on:
Reported: 2017-08-16 08:07 UTC by Silviu Lupu
Modified: 2017-08-18 09:41 UTC (History)
2 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 Silviu Lupu 2017-08-16 08:07:05 UTC

I have a Single-View app made in Xamarin, with Visual Studio 2017. If I run the app from Visual Studio in Debug mode, the app gets installed in Android/data/...

If I build on release and sign the apk Ad-Hoc(the use adk to install), or run on release directly, the app gets installed, but I am unable to find where. Apparently it is in a secure hidden location on the device, where I have no access.

Is there something special I need to do to have an apk that can be installed and deployed in Android/data/.. ?

Thank you.
Comment 1 Jon Douglas [MSFT] 2017-08-16 17:52:09 UTC
I would highly recommend you use an app from the app store such as "My APK" or a similar tool to see the exact path it's being installed to.

Typically apps get installed to internal memory via:


You can also use a file explorer to view these items too. You will want to see exactly where it's being installed first.

I would highly recommend looking at the following answer to get a better understanding:

Comment 2 Silviu Lupu 2017-08-17 06:40:21 UTC

I am using ES File Explorer to see the storage. 

This is the way I am getting the path:
string path = System.Reflection.Assembly.GetExecutingAssembly().Location;

When I run from DEBUG mode, the location it gives me is: /storage/emulated/0/Android/data/com.smallcaps.app/files/.__override__/com.smallcaps.app.dll
Also, I am able to find the folder using ES File Explorer, and the location is /Android/Data/com.smallcaps.app/files

The same behavior happens when I install an apk from google play.

But, when I run from RELEASE mode, the location give is:

Also, I am unable to find any folder with that name using ES File Explorer.

The same behavior as the one on Release, happens to the apks installed with Signed Ad-Hoc certificate.

From what I could deduce, is the fact that the installation takes place in a restricted area of the internal memory, where I have no access, and thus, I cannot get a path due to security issues?
Comment 3 dean.ellis 2017-08-17 09:38:31 UTC
The system is working as expected in this case. Our development tools use the android tooling to install the apk so the apps end up where ever the android tooling installs them. Typically /data/app/<package>.

A quick question, what is it you are trying to do which means you need access to the installation directory? I you are trying to load content that you have included via `AndroidAsset` then you should be using the AssetManager [1] to do that. On older versions of android the application was not extracted from the .apk so there is no way to use System.IO.* to load files from the application "folder".

[1] https://developer.xamarin.com/guides/android/application_fundamentals/resources_in_android/part_6_-_using_android_assets/
Comment 4 Silviu Lupu 2017-08-17 09:43:19 UTC

I am trying to create folders, create databases, download specific files, load dlls via MEF. These operations take place in to folder of the solution. Also, I am writing logs at that location,  that I wanted to be able to see. These all work while building on Debug.

In order to reproduce the behavior that is seen when installing google play apks, what do I need to do? To make an apk and signed it with a Google Play Certificate? Do I need to upload it to Google Play?
Comment 5 dean.ellis 2017-08-17 12:56:43 UTC
To reproduce the "release" behaviour in debug mode you need to switch off Fast Deployment. This will embed the assemblies into the .apk that is installed on the device. It should allow you to reproduce the environment. 

Debug works in debug because the `/storage/emulated/0/Android/data/com.smallcaps.app/files/.__override__/` is writable. 

You cannot write data into the application folder on a release device, this is a security feature.

You should be using a folder like 


This should get you a path to the private storage area for the user. Or use one of the other ones available like 


I would advise you take a look at https://forums.xamarin.com/discussion/3773/system-environment-specialfolder
Comment 6 Silviu Lupu 2017-08-18 09:41:37 UTC
Thank you for the answer. I will try to implement your suggestion.