Bug 29446 - Building Android project
Summary: Building Android project
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Android Add-in ()
Version: 5.8
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: master
Assignee: Greg Munn
URL:
Depends on:
Blocks:
 
Reported: 2015-04-27 19:00 UTC by Colin Kirk
Modified: 2015-05-01 11:09 UTC (History)
3 users (show)

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


Attachments
Log files post-crash from the previously attached MobileCompanion.Droid project (1.79 KB, application/zip)
2015-04-29 11:05 UTC, Colin Kirk
Details
The only log files produced after fully removing all others from the directory (1.80 KB, application/zip)
2015-04-29 11:45 UTC, Colin Kirk
Details
Log files post-crash from adding a new layout (1.65 KB, application/zip)
2015-04-29 16:36 UTC, Colin Kirk
Details
Screenshot of message prior to crash/hang (88.91 KB, image/png)
2015-04-29 16:37 UTC, Colin Kirk
Details
Log files post-crash from adding a new layout in Alpha build of XS (1.66 KB, application/zip)
2015-04-30 11:04 UTC, Colin Kirk
Details
Screenshot of XS UI during crash/hang after adding new layout in Alpha build (76.47 KB, image/png)
2015-04-30 11:05 UTC, Colin Kirk
Details
Screenshot of SDK warning after trying to open a layout file in the designer view (20.41 KB, image/png)
2015-04-30 12:08 UTC, Colin Kirk
Details
Incompatible warning after updating SDK and trying to open a layout in the designer view (18.39 KB, image/png)
2015-04-30 12:09 UTC, Colin Kirk
Details
Layout file that when opened produces an XS warning screen (1.37 KB, application/octet-stream)
2015-04-30 12:14 UTC, Colin Kirk
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 Colin Kirk 2015-04-27 19:00:48 UTC
Description of Problem:
Building an Android project constantly crashes/hangs until Force Quit. The app contains build errors that are displayed in the Build Output pane, but are just simple reference errors.

Steps to reproduce the problem:
1. Create an android project
2. Build All


Actual Results:
Xamarin hangs and needs to be fully quit.

Expected Results:
It should display the build errors and abandon the build.

How often does this happen? 
Every time, until I correct the build errors.

Additional Information:
Comment 1 Tajinder Singh 2015-04-28 06:15:13 UTC
I have try to reproduce this issue and unable to reproduce this issue by description and steps.

Please refer to screencast: http://www.screencast.com/t/9BLUUdiZct
ide logs: https://gist.github.com/saurabh360/c67e3d5f53433602dc6f

Can you please provide Screencast, Logs and Sample.

I follow steps to reproduce:
1. Create an android project
2. Build All
3. Observed that XS is not hangs and crash.

Additional information:
I have checked this issue with XS 5.8.1 (build 2) and it is working fine.
Please refer to screencast: http://www.screencast.com/t/QTmG6rFiDv1

Environment Info:
=== Xamarin Studio ===

Version 5.9 (build 436)
Installation UUID: d6f15b80-470e-4e50-9aba-38a45c556680
Runtime:
	Mono 4.0.1 ((detached/735f5b3)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000008

=== Apple Developer Tools ===

Xcode 6.3 (7569)
Build 6D570

=== Xamarin.iOS ===

Version: 8.10.0.269 (Enterprise Edition)
Hash: 62f9f08
Branch: master
Build date: 2015-04-27 22:39:33-0400

=== Xamarin.Android ===

Version: 5.1.0.115 (Enterprise Edition)
Android SDK: /Users/360logica/Desktop/Anddk/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.0.0.269 (Enterprise Edition)

=== Build Information ===

Release ID: 509000436
Git revision: 7e8ba4cbccf7b188ce5e80a90fdc4acdedb5a83f
Build date: 2015-04-23 13:19:57-04
Xamarin addins: 21fd95f743742c5237e22023996c2800ce3f8db3

=== Operating System ===

Mac OS X 10.10.0
Darwin 360Logicas-MacBook-Pro.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 3 Greg Munn 2015-04-29 10:23:19 UTC
Hi Colin, thanks for the sample project. I've tried this with both XS 5.8.3 and 5.9 and experienced no issues so we'll have to dig a little to figure it out. Can you please open the log folder (Help | Open Log Directory) and then reproduce the problem. Try to grab the latest log files for both the IDE and Android and we'll see if that can shed some light on it.

Do you experience the same issue with any other android projects? Can you reproduce this with a new android app for instance?
Comment 4 Colin Kirk 2015-04-29 11:05:39 UTC
Created attachment 10956 [details]
Log files post-crash from the previously attached MobileCompanion.Droid project
Comment 5 Colin Kirk 2015-04-29 11:08:58 UTC
I tried creating a new android application project and removing some references, but could not reproduce the error.

When I reopened the project that I previously attached and run a Build All, it didn't crash and properly reported the build errors. I then launched the Xamarin Android Player (Kit Kat) and then selected to run to the player from XS, and it crashed as per usual. Maybe try that out on your end.
Comment 6 Greg Munn 2015-04-29 11:32:35 UTC
Thanks Colin. Unfortunately the logs have almost nothing in them, I'm fairly certain these aren't the ones we need - in the Android Log once you open an android project you should see entries about how many devices it has found

[2015-04-29 11:06:22.7] INFO: Found Xamarin.Android 5.1.0
[2015-04-29 11:06:22.7] INFO: Found Android SDK. API levels: 10, 15, 19, 20, 21
[2015-04-29 11:07:59.3] INFO: Tracking android devices started
[2015-04-29 11:07:59.3] DEBUG: TrackDeviceTask got: 
[2015-04-29 11:07:59.3] INFO: Got new device list from adb with 1 devices

The fact that your log only shows the first 2 lines indicates that perhaps we have the wrong log files. Try this, close XS, move / delete all the log files from the log directory, start up XS, try to reproduce the error, then zip up all the log files that are created. We should get some more info in the log.

I did try to run with the Player as well, which made no difference (not really much of a surprise because before we try to do anything with the emulator like starting it, deploying etc, we need to get the project built - which it doesn't because of the references that are missing).

Have you tried cleaning / removing all the prior output and rebuilding again. You mention that the problem goes away if you fix the build errors but comes back again with the build errors. Can you reproduce that with a different error - some syntax error or something rather than the missing references? If the problem only occurs with the missing references, could you tell me more about where these are and how you are referencing them? Ideally, attach them if possible.
Comment 7 Colin Kirk 2015-04-29 11:45:03 UTC
Created attachment 10959 [details]
The only log files produced after fully removing all others from the directory
Comment 8 Colin Kirk 2015-04-29 11:56:44 UTC
So, the error started producing itself in another one of my projects where I am certain I have no error. I tried it a few times and it still hanged after displaying....

Build succeeded.
	 0 Warning(s)
	 0 Error(s)

... in the build output, so I would gather that it doesn't really matter too much if there is a reference error or not. I tried cleaning the project and that didn't change anything either. I tried switching to one of the older projects with the reference error and that didn't create the error. After crashing and trying a few more times, the project that was crashing stopped exhibiting the error... so I am really stumped. I hope you find something in those last log files.

Is this the time you ask me to fully reinstall my XS?
Comment 9 Greg Munn 2015-04-29 13:22:30 UTC
:) no, not yet. I will ask the first thing they teach you in tech support 101 though - have you re-booted?

Those logs certainly are devoid of any real information. It's hard to tell if the issue is before the build finishes or afterwards. XS uses an external process which it launches to host its copy of xbuild/msbuild, so it's possible that the hang might be between that process and XS. Open the Errors pad and show the Build Output pane (which shows up on the right of the Errors pad. Repeat the repro and see if you can determine if XS hangs before or after the build completes.
Comment 10 Colin Kirk 2015-04-29 16:35:48 UTC
I have definitely rebooted.

I am not sure if the build completes or not, since sometimes I get the "Build succeeded" message, and other times, not. 

I have another bug, and it could be related. Anytime I add a new layout view to the "Resouces/layout" folder I crash/hang. It again requires me to Force Quit out of XS. I have attached my logs and a screenshot of a warning I get prior to the error.
Comment 11 Colin Kirk 2015-04-29 16:36:45 UTC
Created attachment 10965 [details]
Log files post-crash from adding a new layout
Comment 12 Colin Kirk 2015-04-29 16:37:50 UTC
Created attachment 10966 [details]
Screenshot of message prior to crash/hang
Comment 13 Greg Munn 2015-04-29 17:33:53 UTC
Thanks Colin, I'm still really puzzled that your log files have such little information in them. The content of all the logs I've seen only contain the startup logging, nothing afterwards. If you open an android project you should be seeing more event like I showed you before. That message in with the NRE should have showed up in there as well.

Can you try the current alpha version of XS (5.9) and see if this makes a difference. Also, when prompted please enable Automated Feedback, or check that "Preferences | Automated Feedback | Report errors and usage" is enabled.

The hang may well be related to your other problem and if we can get the error logged and reported then we can narrow down on it.
Comment 14 Colin Kirk 2015-04-30 11:04:25 UTC
Created attachment 10979 [details]
Log files post-crash from adding a new layout in Alpha build of XS
Comment 15 Colin Kirk 2015-04-30 11:05:10 UTC
Created attachment 10980 [details]
Screenshot of XS UI during crash/hang after adding new layout in Alpha build
Comment 16 Colin Kirk 2015-04-30 11:08:00 UTC
I tried switching to the Alpha build this morning and adding a new layout but this still crashes the UI (attached image and logs). This occurs after I choose to create a new Android layout and click the "New" button.

I should mention however, that when I load up XS again, the layout that I wanted to create, has in fact been created. This also happened in the Stable release I was previously on.
Comment 17 Greg Munn 2015-04-30 11:33:03 UTC
Colin, can you try something for me because these log files are still not showing anything beyond the initial start up entries.

Open XS, and then open an android project.
Close XS.

When you look at the log files, particularly the androidtools log, you should see the entries that show that XS is monitoring android devices attached to adb. I want to make sure that we're grabbing the right logs.
Keep in mind that XS creates new log files when it starts up, so you may need to look at more than one to find the right ones, and if you've restarted XS to open the log folder the logs you want aren't necessarily going to be the latest in the folder.

Back to the hang. 

1. Are you able to open the layout file (and show the designer) after you restart and re-open the project or does it always crash? you may have answered that, just checking.

2. If you could attach the entire project / sln that could help a lot in reproducing the issue.
Comment 18 Greg Munn 2015-04-30 11:53:58 UTC
I forgot to also ask

3. if you open the designer on an existing layout before adding a new layout, are you able to add the new layout without XS hanging?
Comment 19 Colin Kirk 2015-04-30 12:08:36 UTC
Created attachment 10983 [details]
Screenshot of SDK warning after trying to open a layout file in the designer view
Comment 20 Colin Kirk 2015-04-30 12:09:26 UTC
Created attachment 10984 [details]
Incompatible warning after updating SDK and trying to open a layout in the designer view
Comment 21 Colin Kirk 2015-04-30 12:14:05 UTC
Created attachment 10985 [details]
Layout file that when opened produces an XS warning screen
Comment 22 Colin Kirk 2015-04-30 12:17:04 UTC
Okay, I think I got something. I tried opening the designer view for an Android view and noticed that my Android SDK was out-of-date (attached). I haven't noticed the warning before because I always use the Source Code Editor. I updated my SDK and restarted XS, which now lets me add layouts without hanging. I opened the newly created layout and it properly displayed the layout graphically. Then I tried opening one of my more customized layout files (attached) and it gave me a different error (attached).

I think maybe my SDK was giving me all these troubles. I will try it out today and see if I am able to produce any of the Build hangs I was experiencing. If this is the problem, I was under the impression that XS was handling the SDK updates in its regular update process. Is the SDK update handled entirely by the user?
Comment 23 Greg Munn 2015-04-30 12:23:17 UTC
That sounds promising Colin! No, unfortunately at this time XS does not manage android sdk updates - but that is something we want to address.

Can you tell me which sdk version you had installed? If nothing else it would be good to get a good repro for this so that we can add appropriate error handling in the right spot - hanging the IDE isn't the experience we're looking for :)
Comment 24 Colin Kirk 2015-04-30 12:29:51 UTC
Yeah, I know! I am pumped :)

I knew I should have taken a screenshot. I thiiiink I was on Android SDK Tools 22.0.3, but that is a guess. However, that was only one of the updates, there were about 15-20 items updated. Are there any kind of update logs I can send you?
Comment 25 Greg Munn 2015-04-30 12:32:02 UTC
Honestly I have no idea.
Comment 26 Colin Kirk 2015-05-01 11:06:36 UTC
So I haven't had any crashes or hangs since updating my SDK. I am pretty confident that this was the problem. I will change this ticket's status to resolved/fixed.

Thanks a lot for your help Greg. It is much appreciated :)
Comment 27 Greg Munn 2015-05-01 11:09:20 UTC
you're welcome.