Bug 12550 - fastdev installation fails on some Samsung device
Summary: fastdev installation fails on some Samsung device
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Tools and Addins ()
Version: 4.7.x
Hardware: PC All
: High major
Target Milestone: ---
Assignee: Radek Doulik
URL:
: 20936 ()
Depends on:
Blocks:
 
Reported: 2013-06-04 20:37 UTC by Atsushi Eno
Modified: 2014-07-01 06:29 UTC (History)
10 users (show)

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


Attachments
xbuild /t:Install /v:diag *.csproj > log.txt (158.94 KB, text/plain)
2013-06-25 05:08 UTC, Atsushi Eno
Details


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:
Status:
RESOLVED FIXED

Description Atsushi Eno 2013-06-04 20:37:14 UTC
On XA 4.7.x I tried deploying XA apps on Samsung Galaxy Note which runs ICS (4.0.4) so far and it fails to deploy via fastdev. Any app I tried (right now I tried GooglePlayServicesTest in monodroid-samples).

non-fastdev deployment works.

I assume recent seppuku/broadcast change does not work for it.
Comment 1 Jonathan Pryor 2013-06-05 16:23:45 UTC
Does this work?

    adb shell am force-stop your.app.package.name

Can you provide the deployment logs & logcat output?
Comment 2 Atsushi Eno 2013-06-05 21:09:40 UTC
force-stop works for "embedded" apps (fastdev apps cannot be installed so it never starts, hence no way to force stop them).

I'm not sure what you meant "delopyment logs". The "Deploy to Device" pane output is simple:
----
Detecting installed packages

Removing old runtimes

Installing platform framework

Removing previous version of application

Installing application on device

Synchronizing assemblies

Deployment failed because the FastDev assembly directory could not be created.

Deployment failed. FastDev directory creation failed.
----

It's almost impossible to provide logcat output as it is in use in real life and there are too many interrupting log lines even within one single minute. I can search for specific text in the log though.
Comment 3 Jonathan Pryor 2013-06-05 21:22:12 UTC
Device Deployment logs:

http://docs.xamarin.com/guides/android/deployment%2c_testing%2c_and_metrics/diagnostics#2.device-deployment-logs

What's in the Xamarin Studio Deploy pane is useless; we need Xamarin Studio's log files.

Or skip Xamarin Studio entirely and stick with xbuild/MSBuild:

    $ xbuild /t:Install /v:diag *.csproj > log.txt

> fastdev apps cannot be installed

Wat? How can they not be installed at all? That's truly mind boggling...

The messages you provided certainly imply that the app was installed...

> Installing application on device


> It's almost impossible to provide logcat output

I'm a master of grep. ;-)

Just log everything to a file, then attach the file:

    $ adb logcat > log.txt
    # install the app onto the device...

Please attach the log file, even if it is constantly interrupted. Or you can filter to just the interesting messages:

http://docs.xamarin.com/guides/android/deployment%2C_testing%2C_and_metrics/android_debug_log#4.interesting-messages
Comment 5 Atsushi Eno 2013-06-25 05:07:55 UTC
> The messages you provided certainly imply that the app was installed...
>> Installing application on device

This is *installing*, not *installed*.

I'm going to attach the build log and the adb log next.
Comment 6 Atsushi Eno 2013-06-25 05:08:57 UTC
Created attachment 4192 [details]
xbuild /t:Install /v:diag *.csproj > log.txt
Comment 8 Atsushi Eno 2013-06-25 05:11:26 UTC
-> reopened
Comment 9 Jonathan Pryor 2013-06-25 10:41:04 UTC
@Eno: As per Comment #6, command-line based installation is successful:

> 		TASK: GetRemoteFileInfo /data/data/mono.actionbarsherlocktest/files/.__override__ completed?:Completed
> 		DEBUG: Stat:FileInfo for /data/data/mono.actionbarsherlocktest/files/.__override__: drwxrwxrwx
> ...
> 	 0 Error(s)

So this appears to be an issue with the Xamarin Studio-side of things. Which brings us to Comment #7, which is `adb logcat`. It shows that the process was started, and thus the .__override__ directory _should_ exist (assuming this log file is from a Xamarin Studio install, and not during Comment #6):

> Pub mono.actionbarsherlocktest.mono.MonoRuntimeProvider.__mono_init__: mono.MonoRuntimeProvider
> No assemblies found in '/data/data/mono.actionbarsherlocktest/files/.__override__' or '/mnt/sdcard/Android/data/mono.actionbarsherlocktest/files/.__override__'. Assuming this is part of Fast Deployment. Exiting...
> Process app.processName (pid 11158) has died.

The question is why Xamarin Studio isn't installing things. We need the Xamarin Studio install logs:

http://docs.xamarin.com/guides/android/deployment%2c_testing%2c_and_metrics/diagnostics#2.device-deployment-logs
Comment 14 PJ 2013-06-28 14:01:29 UTC
Atsushi, do you still have fast deployment issues when installing on your Galaxy Note? We're looking to finalize 4.8 and would love to know if the current 4.7.11 alpha fixes the issue for you.
Comment 15 Atsushi Eno 2013-06-28 15:15:31 UTC
Yes, ongoing issue.
Comment 17 Jonathan Pryor 2013-06-30 03:27:29 UTC
This isn't a Xamarin.Android bug, per se, as using xbuild to install works, as per Comment #6. This appears to be a Xamarin Studio issue.

Eno: which version of Xamarin Studio are you using? Could you please try the latest version if you haven't already done so?
Comment 18 Atsushi Eno 2013-07-01 00:56:46 UTC
It was already on our latest master.
Comment 19 Jonathan Pryor 2013-07-10 18:11:03 UTC
Eno: Is this a Debug or a Release build? Does this happen for all projects or just some?

Please provide both the `adb logcat` and the Xamarin Studio log files for the same installation attempt. I need to be able to see "both sides" of what's happening, and I suspect/fear that Comment #7 and  Comment #16 are not from the same package installs (especially since they're 3 days apart).
Comment 20 PJ 2013-11-19 16:38:20 UTC
This bug was targeted for a past milestone, moving to the next active non-hotfix milestone.
Comment 21 Atsushi Eno 2013-12-11 04:09:34 UTC
I cannot test it anymore, as my Galaxy Note has broken USB connector :(

Not sure what to do with this bug. Maybe we keep it for a while until we clean up NEEDINFOs and/or wait for someone who experience this.
Comment 22 Jonathan Peppers 2013-12-30 11:41:05 UTC
This is still happening to me on 4.10.1 stable with a Samsung Galaxy S4.

I tried a Sony phone and it worked fine. Is a fix coming for this?

Can it just automatically revert to turn off FastDev if it fails? I would prefer to see a warning in the build/deploy or something if that fails and not a scary Android man on a popup.
Comment 23 Jonathan Pryor 2013-12-30 12:14:16 UTC
> Is a fix coming for this?

The problem, as best as we've been able to determine, is Samsun KNOX, which blocks access to the .__override__ directory, preventing `adb push` from copying files into the .__override__ directory, and screws things up.

It is not currently _easily_ possible for us to detect this situation either; IIRC a message from KNOX is written to logcat, but we don't parse logcat, so that's not entirely helpful at this time... (Yet another reason to write some `logcat` parsing code...)

That said, we have someone looking into this, but he's also working on many other things, so I wouldn't hold your breath on this being fixed any time soon (unless Samsung deigns to let us know how KNOX works so that we could disable KNOX's blocking of directory writes to the .__override__ directory, assuming that's even possible... There's not a whole lot of public information about KNOX, afaik.).
Comment 24 Jonathan Peppers 2013-12-30 13:37:39 UTC
Right, so can this not be a blocking failure.

I think it would be better to have FastDev fall back to normal if it fails and not stop the developer dead in his tracks. (Maybe just display a warning somewhere)

It's to the point where I tell people to turn off FastDev not matter what, because there is always a Jr dev somewhere with a Samsung phone that can't figure out what is wrong.
Comment 26 Support 2014-02-19 01:08:30 UTC
I have a problem with Samsung Note 3 (Model: SM-N9005) Android Version: 4.4.2

Situation:

During our first development, we can't debug the application. The App will be deployed to the device, it starts but it will automatically be closed.

I disabled the fastdev option. Now I can deploy without error, but the debug doesn't work.

I uninstalled already "KNOX", but it was not a solution.

With another Samsung Galaxy 2, the same project works and we can also debug.

It seems, that the failure is specific to the device Samsung Note 3 !

Have somebody any idea ?
Comment 27 Jerome Laban 2014-04-10 09:51:50 UTC
I'm having a similar issue with the Samsung Galaxy Note 3 (Android 4.4.2), using VS2013 with Xamarin.Android 4.12.3:

Error message:
Xamarin.AndroidTools.AndroidDeploymentException: FailedToSynchronizeFastDevAssemblies ---> Mono.AndroidTools.AdbException: Permission denied
   at Mono.AndroidTools.Util.AggregateAsyncResult.CheckError(CancellationToken token)
   at Mono.AndroidTools.Adb.AdbSyncClient.EndPushSyncItems(IAsyncResult result)
   at Mono.AndroidTools.Internal.AdbClientTaskExtensions.InnerInvoke(TaskCompletionSource`1 tcs, Func`2 endMethod, IAsyncResult l)
   --- End of inner exception stack trace ---
   at Xamarin.AndroidTools.AndroidDeploySession.InstallAssemblies(String destinationPath, CancellationToken token)
   at Xamarin.AndroidTools.AndroidDeploySession.FastDev()
   at Xamarin.AndroidTools.AndroidDeploySession.Run(CancellationToken token)
   at Xamarin.AndroidTools.AndroidDeploySession.RunLogged(CancellationToken token)
   at Xamarin.AndroidTools.AndroidDeploySession.Start(CancellationToken token)
Comment 28 Mehmet Kartalbas 2014-05-06 15:51:13 UTC
Here same issue since month, S4, Note 3, TabPro 8.4, NotePro10.1, NotePro12... Currently I cannot develop with all my samsung devices, I think THIS bug is really a killer!
Comment 29 Peter Collins 2014-05-06 16:27:06 UTC
A very simple workaround for not being able to deploy to Samsung devices in debug mode is to disable "Fast assembly deployment" for your project. This option can be found in 'Project Options' -> 'Android Build' -> uncheck 'Fast assembly deployment'.

This will allow Debug deployment and proper debugging, but deployment times will be slightly slower.
Comment 30 Mehmet Kartalbas 2014-05-06 16:31:41 UTC
I know about this workaround, nevertheless thanks for mentioning but this is not a option for me so I'm using different devices. Deploying with visualstudii is *slow and more slower is really bad it steals time on trying something you know how many times a developer is deploying on a day...
Comment 31 PJ 2014-05-06 19:52:34 UTC
The status and milestone of this bug are out of date, the problem is confirmed and we're past 4.10.  

Updating bug status and milestone.
Comment 33 Mohit Kheterpal 2014-06-30 06:46:43 UTC
*** Bug 20936 has been marked as a duplicate of this bug. ***
Comment 34 David Ávila Membrives 2014-06-30 10:21:31 UTC
With a Nexus 5 with Android 4.4.4 and the latest Xamarin Android installed there are no problems.

But with the same Nexus 5 and the Android L preview (http://developer.android.com/preview/index.html) I've got the fastdev error.
Comment 35 Radek Doulik 2014-07-01 06:29:21 UTC
This issue will be fixed in the next 4.14.x release.