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

17,659

Solution 1

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.

Solution 2

I had the same problem. After removing the dash "-" sign from the image file name, the problem is solved. Bad error message! It should not be:

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

Writing an error message like this causing the Developer to think about something else while the problem is the illegal file name.

Solution 3

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.

Solution 4

I had the same problem, and i removed all image file name have "-" character. My problem solved

Solution 5

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.
Share:
17,659

Related videos on Youtube

Dawid Sibiński
Author by

Dawid Sibiński

Full stack developer coming from .NET environment. Digital nomad 🌍💻 Blogger @ codejourney.net.

Updated on September 15, 2022

Comments

  • Dawid Sibiński
    Dawid Sibiński over 1 year

    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:

    1. Xamarin.Android project (main one)
    2. Android-specific unit tests run on the device - project of type NUnit 3 Test Project (Android) created using NUnit Templates for Visual Studio
    3. Platform-independent unit tests project (project of type Unit Test Project (.NET Framework))

    Everything worked just fine until now. When I selected my main project as the Startup one, my app was deployed to the device/emulator. When I selected my Android-specific unit tests project, the test project was deployed and unit tests executed by nUnit Xamarin Runners on the device/emulator.

    However few days ago I updated my Visual Studio 2017 with the newest available update and now, when trying to build this android-specific unit tests project I get the following error:

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

    I've searched everywhere, including this and this SO topics. I also totally reinstalled Visual Studio 2017 and Xamarin with Android SDK included. Nothing helped. From what I read I suspect there is something wrong with the versions of Android SDK Build-tools I have installed. Here's what I have currently installed in SDK Manager: enter image description here

    As the other SO threads suggested, I tried uninstalling the newest Android SDK Build-tools (25.0.2) and installed version 23.0.3 (all my projects target Android 6.0), but it also doesn't help, I still have the same error.

    Maybe it's worth adding that this issue may have started to happen when I tried to implement RecyclerView in my app reading this tutorial, where they suggested to install Android 7.1.1 (API 25) in SDK Manager. However I undoed my all changes after that and even reintalled VS2017 + Xamarin.

    Do you have any other idea why this can be ? I'd really appreciate any help. Thanks!

    EDIT 2017-04-09:

    Egh, I removed VS2017, installed VS2015 with brand new Android SDK and still the same issue :(

  • Cleyton T.
    Cleyton T. about 7 years
    Yep. The Diagnostic option saved my life. In my case, the problem was caused by an image that I added into Resources/drawable folder with a dash in the name. I discovered that by turning on that Diagnostic option. Thanks @DawidSibinski!
  • howardlo
    howardlo about 7 years
    A small invalid .axml tag chewed up a day for me too. Microsoft/Xamarin, please get intellisense working and make this better!
  • SourceSkyBoxer
    SourceSkyBoxer about 7 years
    Still error :( You said "[Activity(Label = "People List")]" than the build is passing without any issues. Hahaha you're liar! I have tried but I got error. :( like The file "obj\Release\android\bin\packaged_resources" How do I fix? Stop scamming us!
  • Dawid Sibiński
    Dawid Sibiński about 7 years
    @SourceSkyBoxer hehe, you sound funny ;) Have you checked your build output with verbosity set to Diagnostic? If yes, paste the detailed error's contents here.
  • paketman
    paketman almost 7 years
    Thanks !! Diagnostic saved me also. My case was an invalid png file which I had renmed from jpg
  • Samuel Ivan
    Samuel Ivan over 6 years
    In addition to the "-", no name with accented graphical accents.
  • Exel Gamboa
    Exel Gamboa over 6 years
    Nice! After I removed the "-" character from my icon files, the real problem was detailed in my output window and this helped me to solve the problem.
  • EduXavier
    EduXavier over 6 years
    neither spaces.