Bug 56894 - Android app is never deployed to the simulator if the simulator is not already running
Summary: Android app is never deployed to the simulator if the simulator is not alread...
Status: NEEDINFO
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: 7.3 (15.2)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2017-05-26 21:20 UTC by reemfz
Modified: 2017-10-19 03:54 UTC (History)
3 users (show)

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


Attachments
Xamarin and Visual Studio logs (2.48 MB, application/x-zip-compressed)
2017-07-28 06:18 UTC, drobosson
Details

Description reemfz 2017-05-26 21:20:16 UTC
Hello,

I discovered another strange issue (maybe related to Windows 7 again, I am not sure) but basically if I build and run any android app from visual studio 2017 and the emulator is not already running, the app will never get deployed. Instead, visual studio will build the project, then launch the emulator and the build process will idle forever. 
The only workaround I found was to kill the build process and re-run the app. Then everything works.

Also, if I launch the emulator prior to running the app, then it gets deployed fine.

nothing too sever of course, but something you guys should look into.

below is the stuff that gets printed out to the output window.

Cheers,

1>Starting deploy VisualStudio_android-23_x86_phone ...
1>Starting emulator VisualStudio_android-23_x86_phone ...
1>C:\PROGRA~2\Android\ANDROI~1\tools\emulator.EXE -partition-size 512 -no-boot-anim -avd VisualStudio_android-23_x86_phone -prop monodroid.avdname=VisualStudio_android-23_x86_phone
1>Hax is enabled
1>Hax ram_size 0x40000000
1>HAX is working and emulator runs in fast virt mode.
1>audio: Failed to create voice `goldfish_audio_in'
1>qemu-system-i386.exe: warning: opening audio input failed
1>emulator: Listening for console connections on port: 5554
1>emulator: Serial number of this emulator (for ADB): emulator-5554
1>Emulator VisualStudio_android-23_x86_phone is running.
1>Waiting for emulator to be ready...
1>Deploying VisualStudio_android-23_x86_phone ...
1>Build started.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Roslyn\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__;__ANDROID_24__;__ANDROID_25__ /errorendlocation /preferreduilang:en-US /reference:"C:\Program Files (x86)\Microsoft Visual 
 /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /target:library /utf8output MainActivity.cs Resources\Resource.Designer.cs Properties\AssemblyInfo.cs "C:\Users\rfazio\AppData\Local\Temp\MonoAndroid,Version=v7.1.AssemblyAttributes.cs" obj\Debug\\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs obj\Debug\\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs obj\Debug\\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
1>TipCalculator -> E:\Xamarin University\Xamarin Android\TipCalculator\TipCalculator\bin\Debug\TipCalculator.dll
1>  Processing: obj\Debug\res\layout\main.xml
1>  Processing: obj\Debug\res\values\strings.xml
1>C:\Program Files\Java\jdk1.8.0_112\\bin\keytool.exe -list -alias androiddebugkey -storepass android -keypass android -keystore "C:\Users\rfazio\AppData\Local\Xamarin\Mono for Android\debug.keystore" 
1>C:\Program Files\Java\jdk1.8.0_112\\bin\jarsigner.exe -keystore "C:\Users\rfazio\AppData\Local\Xamarin\Mono for Android\debug.keystore" -storepass android -keypass android -digestalg SHA1 -sigalg md5withRSA -signedjar bin\Debug\\TipCalculator.TipCalculator-Signed-Unaligned.apk "E:\Xamarin University\Xamarin Android\TipCalculator\TipCalculator\obj\Debug\android\bin\TipCalculator.TipCalculator.apk" androiddebugkey 
1>No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2046-05-16) or after any future revocation date.
1>C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.3\zipalign.exe 4 "E:\Xamarin University\Xamarin Android\TipCalculator\TipCalculator\bin\Debug\TipCalculator.TipCalculator-Signed-Unaligned.apk" "bin\Debug\\TipCalculator.TipCalculator-Signed.apk"
Comment 1 Jon Douglas [MSFT] 2017-06-26 15:50:51 UTC
Thank you for the bug report! We really appreciate you taking the time to report this issue.

The first thing we will want is your current version of Visual Studio and all of your VS logs. To obtain these, you can grab it from the following location:

In Visual Studio, version information can be copied from: Help -> About Microsoft Visual Studio -> Copy Info button and the log files can be gathered from %LOCALAPPDATA%\Xamarin\Log

The second thing we will want is a full diagnostic build output of your project. This will help us identify what versions of Android tooling are used in your local build process.

https://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/#Diagnostic_MSBuild_Output
Comment 2 drobosson 2017-07-28 06:14:42 UTC
I confirm this behavior.

Steps taken:
1. Clean build
2. Build
3. Debug deployment run, emulator starts, break hung deployment
4. Debug deployment run after previous emulator running

Will attach logs.
Comment 4 Jon Douglas [MSFT] 2017-10-13 17:50:14 UTC
Seeing that ZipAlign is hanging for both of you, can you both please try running the ZipAlign command manually from a command line to see if it hangs there as well?

i.e. (Please ensure you are on the latest version of Build-tools in yor SDK)

C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.3\zipalign.exe 4 "E:\Xamarin University\Xamarin Android\TipCalculator\TipCalculator\bin\Debug\TipCalculator.TipCalculator-Signed-Unaligned.apk" "bin\Debug\\TipCalculator.TipCalculator-Signed.apk"

and

C:\Program Files (x86)\Android\android-sdk\build-tools\26.0.0\zipalign.exe 4 "C:\Development\Test\PetroGuardGo\Products\CoreClient\CoreClient.Android\bin\Debug\PetroGuardGo.AndroidClient-Signed-Unaligned.apk" "bin\Debug\\PetroGuardGo.AndroidClient-Signed.apk"
Comment 5 drobosson 2017-10-19 03:54:20 UTC
Manually running zipalign against the source APK does not hang.

Note You need to log in before you can comment on or make changes to this bug.