Forum Xamarin.Forms

Adding png to Resources\Drawable hangs Visual Studio

AEONAEON USMember

Every time I add a png to Visual Studio in our Xamarin.Forms Android project, Visual Studio hangs. Not sure what is causing it, but I didn't have the same issue when adding the first image to the project. I can add images no problem in non-Xamarin apps and also do not have a problem adding it to the share library UI project.

«1

Posts

  • AEONAEON USMember

    Nevermind. If I deleted the image from the project file system under Resources\Drawable, then tried to add it again it doesn't hang. It only seems to hang when it is already in the project file system and I choose to overwrite it.

  • TeoTeo DKMember ✭✭
    edited October 2014

    Hmm, for me it hangs all the time. It doesn't matter if it is a new image or overwriting an old one. It worked until last week, but something happened and now it hangs all the time. I'm trying to add it to drawable-*dpi.

    LE: After finding this , I can also confirm that updating the Android SDK fixes this.

  • AEONAEON USMember

    I've been having to add it to the main project folder then drag it to drawable.

  • MennoMorsink.5503MennoMorsink.5503 USMember, University

    Have been experiencing the same problem for a few days, ending up here, updating SDK now... :)

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    This annoyng bug still (or again) exits in 3.11.576.
    I have added a .png to my android project (\Resources\Drawable) and then had to shut down VS (and lost my last changes) :angry:

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    And.. it's worse... the .png don't was included in the project (and also not showed on the page).
    I now have "included" it in the project... and.. VS hangs once again..!

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    Shut down VS once again, restart VS and once again included the .png in the project...
    Now it seems to work (after two times restart VS and lost of my latest changes). :neutral:

  • MarkWallisMarkWallis AUMember
    edited June 2015

    This bug is happening again for me. (https://bugzilla.xamarin.com/show_bug.cgi?id=18452)
    All versions are in the attached image, Xam 3.11.590, Xam.Android 5.1.3.1 being the most important.
    Only started happening after updating yesterday (09.06.2015). Definitely was not a problem before that.
    I've had to kill VS every time I try to add new .png, regardless of how I try to add it.
    Not urgent to fix I guess since the workaround is to use Xam Studio and add through there...bit of a pain to jump out of VS every time though :-/
    I run VS as Administrator...don't know if that matters...

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @RaphaelSchindler:
    I know, that's a Xamarin.VS-bug (I don't have opened this thread here in the .Forms-Forum - only posted a message including the version to the VS-Integration-SW-Version :tongue:)
    But thanks for the hint (I will try it out, the next time, I have to add an image to the Android-Project) :smile:

  • David.WelshDavid.Welsh USMember

    I was just copying some images to the resources folder and was browsing the forum waiting for visual studio to catch up. Then I seen this thread. Yep, Visual Studio has crashed. I guess I have this problem too. Funny coincidence though.

  • MarcoTMarcoT USMember ✭✭

    Of course I have the same bug. The only way to solve this problem now is to add the .png file .csproj project files using Notepad++

  • David.WelshDavid.Welsh USMember

    I got it working by doing it through Xamarin Studio as @MarkWallis suggested.

  • MiguelCervantesMiguelCervantes MXMember ✭✭✭

    I was doing what @RaphaelSchindler did, it works, but is a headache.

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @AEON, @Teo, @MennoMorsink.5503, @MarkWallis, @RaphaelSchindler, @David.Welsh, @Marco.8016, @MiguelCervantes and at all other readers of this thread.
    Thanks the hint of Raphael, I was able to investigate the problem in detail and - I think - have find out the bug(s) in the integration-SW.
    You can find all details in the attached .pdf
    I also will post in the VS-Formum and fill a bug in bugzilla

    Cheers :smile:

  • RaphaelSchindlerRaphaelSchindler USMember ✭✭✭

    @FredyWenger I have some additions and corrections to your pdf ;)

        Instead do it manually:
        Close VS <-- This is not necessary. I always changed the .csproj file while VS is open.
    
        This has worked in earlier versions (must be a new bug in some newer versions). <-- I'm experiencing this since the beginning of this year from time to time.
    

    Really good work :)

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @RaphaelSchindler:
    Thanks - I only was able to investigate it thanks your base-hint :blush:
    Close VS: As I don't know, what exactly VS cashes to the .csproj-File (in the variouuus "hidden" directories), I close it to be sure :wink:
    In the meantime, I have added a messaging in the VS-thread:
    http://forums.xamarin.com/discussion/42670/stable-service-release-xamarinvs-3-11-586-bug-fixes-for-3-11-445#latest
    and also have filled the bug:
    https://bugzilla.xamarin.com/show_bug.cgi?id=30968

    I finally hope that my (once again invested) few hours give us a (much) more stable IS soon :wink:

  • RaphaelSchindlerRaphaelSchindler USMember ✭✭✭

    I think this is some sort of blocking folders while try writing to one or writing to the .csproj file and it is somehow blocked from VS in another thread. I had some silly behaviour like that with PCL's that I changed.

  • MiguelCervantesMiguelCervantes MXMember ✭✭✭

    @FredyWenger nice job dude! Thank you!

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭
  • jonathanyatesjonathanyates GBMember ✭✭✭

    Same problem here. I've now come to the conclusion that Xamarin is a product that none of us should be paying for.

  • WesselOosthuizenWesselOosthuizen USMember ✭✭

    Same problem here

  • NMackayNMackay GBInsider, University mod

    @WesselOosthuizen

    Have you upgraded to the scary sounding .666 build (stable)? it should/could/possibly sort the VS studio hanging issues.

    https://forums.xamarin.com/discussion/44630/stable-release-xamarinvs-3-11-666-cycle-5-service-release-2#latest

  • WesselOosthuizenWesselOosthuizen USMember ✭✭

    @NMackay yep I have. I think the issue is actually reintroduced in this release...

  • NMackayNMackay GBInsider, University mod

    @WesselOosthuizen

    That would be very ^&%. I'll have to test that tomorrow, something to look forward too :neutral:

  • Info-FrameLtdInfo-FrameLtd HUMember ✭✭

    I have upgraded, and it did fix our long-standing issue of not being able to add resources to Droid projects.
    Our temp fix was to close VS, open the project in XS, and add resources there, then go back to VS.

  • NMackayNMackay GBInsider, University mod

    I did test and it works fine in VS2013 (Update4) with build 666.

  • hvaughanhvaughan USMember ✭✭✭

    For me, while Visual Studio is hanging up, killing the Java task seems to bring everything back for me. I have not tried messing with PNGs since the update mentioned above though.

  • MaxMengMaxMeng NZMember ✭✭✭

    run taskmgr, in Task Manager find monodroid.exe, if it is there kill it, somehow fix my problem.

  • AneeAnee USMember

    I am facing the same issue , while adding images into Resources\Drawable folder, visual studio hangs. I updated Visual Studio and Android SDK Tool. But it doesn't seems to be solving the issue.

    Visual Studio Ultimate 2013 - Ver 12.0.31101.00 - Update 4.
    Android SDK Tools - 24.3.3

    How can solve this issue??????

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @Anee:
    Have you seen my posting from June 10 (above)...?
    I have investigated the problem and found, that's a bug.
    In the attached .pdf you can see all the details and also how to do it manually
    I further have filled a bug (link see second message to June 10).
    It seems (confusing duplicate bugs in BugZilla) as the bug has the state "Confirmed" (but isn't solved yet).

    So I suggest you to do it manually (according my posted .pdf).

    Hope this helps...

  • NMackayNMackay GBInsider, University mod

    This did reoccur for me in a project I'd been working on pre the last stable Xamarin build.

    After killing devenv.exe in taskman I reopened the project and selected "show all files" and then included the file into the project. After that it seemed okay and allowed adding drawables etc.

  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai
    edited July 2015
    • One known cause of this problem is when the Android SDK and the Xamarin versions are mismatched. For example, XamarinVS 3.11.666 with Android SDK Tools 24.2 will hit this problem. Upgrading to Android SDK Tools 24.3 will solve that particular cause of the problem.

      I have filed a bug to request that this kind of version mismatch should produce an error message rather than hanging the IDE.

    • There have also been reports of very similar symptoms that are not caused by the version mismatch issue. In particular, 2 of the reports on Bug 31667 (as well as NMackay's post in this thread earlier today) suggest that this issue can happen during the first attempt to add an image to the resources folder of a particular project. In those reports, force-quitting Visual Studio, reloading the project, and then re-adding the image seemed to help (at least on some attempts).

    • As mentioned in Raphael's, Fredy's, and Marco's posts earlier in the thread, one way to sidestep the issue entirely would be to edit the <AndroidResource> elements by hand in the the text of the .csproj rather than using the Solution Explorer.

  • MartinRothschinkMartinRothschink DEMember ✭✭

    Indeed, I was using SDK-Tools 24.2.

  • 2BitNerd2BitNerd USMember ✭✭

    I'm experiencing this too!

  • AnthonyRamirezAnthonyRamirez USUniversity ✭✭✭

    @2BitNerd
    This worked for me.

    From Brendan Zagaeski's post above
    •One known cause of this problem is when the Android SDK and the Xamarin versions are mismatched. For example, XamarinVS 3.11.666 with Android SDK Tools 24.2 will hit this problem. Upgrading to Android SDK Tools 24.3 will solve that particular cause of the problem.

  • AllisterAllister USMember ✭✭
    edited August 2015

    I've become accustomed to having VS crash on adding an android image asset, and eventually I give in an edit the csproj file by hand.

    If there are lots of assets to add I might use Xamarin Studio, then copy out the xml from the csproj file, undo the other changes Xamarin Studio made to the Android project (and iOS project for some reason, which it always does just by opening the solution), then paste in the copied xml into the csproj file to get the assets into the solution.
    (We've had Xamarin Studio wreck things just by having opened the solution with it in the past, so we pretty much avoid using it on our production apps).

    Today I'm running Android SDK Tools 24.3.4, with Xamarin.Android 5.1.5.3, Xamarin 3.11.837.0, Visual Studio 2015 14.0.23107.0 D14REL, .Net 4.6.00079, wait I'll just copy the version guff from Studio in case that gets something useful too. (Android has API 23 too, just noticed its not listed below so guess Xamarin isn't supporting it yet)

    === Xamarin Studio ===

    Version 5.9.5 (build 10)
    Installation UUID: a2f093b8-9e70-42ef-96b3-d19235a7d8cc
    Runtime:
    Microsoft .NET 4.0.30319.42000
    GTK+ 2.24.22 (MS-Windows theme)
    GTK# 2.12.26

    === Xamarin.Android ===

    Version: 5.1.5 (Business Edition)
    Android SDK: C:\Android\sdk
    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)
    5.1 (API level 22)
    Java SDK: C:\Program Files\Java\jdk1.8.0_51
    java version "1.8.0_51"
    Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
    Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

    === Xamarin Android Player ===

    Not Installed

    === Build Information ===

    Release ID: 509050010
    Git revision: 48d16bc4f12ce3938964fc7c3d72fdc6887ad4ad
    Build date: 2015-08-18 16:53:58-04
    Xamarin addins: c2d51b360ad9f59e689046d47030df27de28f94a

    === Operating System ===

    Windows 6.2.9200.0 (64-bit)

  • StevenLewisStevenLewis USMember
    edited September 2015

    hummm... Apparently the bug is present again... I don't know in the past... but now I am having this same problem... I am using VS 2015 Enterprise, version 14.0.23107.0 D14REL and XS 5.9.5 Build 10, Xamarin Android 5.1.5. OS Windows 10, 6.2.9200.0 (64 bits)

  • hvaughanhvaughan USMember ✭✭✭
    edited September 2015

    @StevenLewis
    I can confirm that Allister's workaround of adding the image directly to the .csproj file works great for me. Just find entries for other images you have already added in there and copy/paste the entries. I always close the solution before editing the file but I am not sure if that is necessary or not.

  • @hvaughan
    Yes, it Works... also opening the Project in Xamarin Studio and adding the image there, then reopen it using Visual Studio.

    Thanks for the reply!

Sign In or Register to comment.