Visual Studio 2017 - Xamarin - The file “obj\Debug\android\bin\packaged_resources” does not exist

后端 未结 14 1757
自闭症患者
自闭症患者 2021-01-01 11:13

I\'m fighting with that issue for 2 days already and can\'t find any solution.

I have an Xamarin Android app in Visual Studio 2017 consisting of three projects:

相关标签:
14条回答
  • 2021-01-01 12:03

    I had the same issue when I added a new image as a resource. There was a '-' in the file name (Invalid resource name character). I renamed & removed that character and all good. Resource name can only consist of 0-9,a-z or A-Z or combination of any.

    0 讨论(0)
  • 2021-01-01 12:03

    Simply it worked.

    1. In one case I copied and pasted previous working "packaged_resources" in the bin folder.[the problem was it did not reflect the UI changes]
    2. Other I opened the visual studio as administrator.
    3. Next changed the "Minimum target to Android" to lower apis in the project properties windows.
    4. I suggest not touching the code behind of the design. If you get this error simply pull some button from the tool bar into the design and visual studio will come to its consciousness that there is change in UI. Next click on save all so that it make necessary change in the designer file.
    0 讨论(0)
  • 2021-01-01 12:03

    Check to see if there are any unused entries in resources.designer.cs if there are any manually remove those entries. This will fix the issue.

    0 讨论(0)
  • 2021-01-01 12:04

    Another reason for this error, if that the android NDK (not android SDK) isn't right, change de version can resolve the problem: go to Tools/Options/Xamarin/android Configurator and change de folder, in my case I've three, the last one can't compile, but the second folder with version xx.r11c do it.

    enter image description here

    enter image description here

    0 讨论(0)
  • 2021-01-01 12:06

    I've finally found what was the issue. It wasn't related to any component from SDK Manager or VS version.

    Following localization tutorial from developer.xamarin.com, I played a bit with Strings.xml in my Android project. I wanted to have my Activities Label taken from resources as well, so in the ActivityAttribute I defined:

    [Activity(Label = "@string/peopleListTitle")]
    

    and added this value in Strings.xml file:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <!-------Other resources values ----->
        <string name="peopleListTitle">People List</string>
    </resources>
    

    In that case my build is failing with above-mentioned error:

    The file "obj\Debug\android\bin\packaged_resources" does not exist

    When I change ActivityAttribute to use a string directly:

    [Activity(Label = "People List")]
    

    the build is passing without any issues.

    I managed to find a solution, but actually I don't know why it's not building when I try to use Label text defined in Strings.xml.

    BTW, I managed to find what's the problem by setting build output verbosity to Diagnostic in Tools -> Options -> Projects and Solutions -> Build and Run which gives a detailed info why the build failed in the Output window.

    0 讨论(0)
  • 2021-01-01 12:10

    Had the same error, the way I got over it was crank up the Android SDK manager and install all updates and remove any obsolete packages. This happened to me because I was targeting something newer which was not installed.

    0 讨论(0)
提交回复
热议问题