Android App Compile Not Generating Package Resources

22,146

Solution 1

I encountered the same issue. Ensure that your resource files do not include any special characters

The actual error you may be encountering is:

Invalid file name: must contain only [a-z0-9_.]

Change your build output verbosity in visual studio to see better log output.

Solution 2

I´ve had the same issue.

Then i´ve reviewed my resource file names.

Solution:

One file was using "-" in it´s name. (invalid character)

Then i replaced for "_" (underline).

PS:

=> file name: must contain only [a-z0-9_.]

Solution 3

You will need to grub down by switching on Verbose output. What is stopping the generation of packaged_resources?

In VS2013 choose Tools --> Options --> Build and execute, choose verbosity Diagnostic.

In VS2015, the same option is in Tools --> Options --> Projects and Solutions --> Build and Run.

In my case, it was a hyphen character in the name of the action property of an Intent filter, but choosing verbose output will point you to the line that has the problem.

Solution 4

i also found that removing the packages in Tools/Preview Channel and Android N AND ALSO Android SDK Build Tools rev 24, done a build and worked.. This is a complete new portable project/android/ios

Solution 5

Follow the steps below to identify the problem:

1 - In Visual Studio: Tools> Options> Projects and solutions> Build and Run.

1.1 - In the dropdown: MSBuild project build output verbosity:> Diagnostic.

1.2 - Close the dialog box.

2 - View> Output (Ctrl + W, O).

3 - Run the build or rebuild.

In the output find the line:

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1665,3): error MSB6006: "aapt.exe" exited with code 1.

What is just above this error is what caused the error.

Share:
22,146
sazr
Author by

sazr

Updated on December 27, 2020

Comments

  • sazr
    sazr almost 3 years

    When attempting to compile my Xamarin.Android app I get the compile error:

    Error 3 The file "obj\Debug\android\bin\packaged_resources" does not exist. MyApp.UI.Droid

    This error occurred after I made some changes (added some new classes - cannot remember what it was). But I didn't change any project settings, nor go delete actual files in the obj folder.

    What is the cause of this error and how can I fix this?

    Some information that may be useful:

    • The project is a Cross-Platform PCL project - Core, Android, and iOS Projects
    • The project uses MVVM Cross
  • jmichas
    jmichas about 8 years
    Thank you! I have spent hours trying to figure out why my resource.designer.cs file wasn't updating. Should be marked as the answer. I had a number of images with dashes in the names.
  • Alexander
    Alexander almost 8 years
    Thanks a lot. With your solution I immediately found one of my resources with an invalid filename (also a hyphen character in the filename).
  • Al Lelopath
    Al Lelopath over 7 years
    Note the in Visual Studio 2015 at least, it is Tools > Options > Projects and Solutions > Build and Run and that there is "build output verbosity" and "build log verbosity".
  • bbsimonbb
    bbsimonbb over 7 years
    Thanks for the tip, I'll modify the answer.
  • Tony Babarino
    Tony Babarino over 7 years
    Link-only answers are generally frowned upon on Stack Overflow. In time it is possible for links to atrophy and become unavailable, meaning that your answer is useless to users in the future. It would be best if you could provide the general details of your answer in your actual post, citing your link as a reference.
  • neo
    neo over 7 years
    Thanks, I was struggling with this issue for hours. removing those packages did the trick for me. with these preview packages, this issue occurs even if you don't have any special characters in your image file name.. Common solution to this problem refers to image file name, but this answer should also be considered.
  • howardlo
    howardlo over 6 years
    In my case, it turns out that there was an invalid tag in an AXML file (layout file). VS2017 intellisense is broken for AXM files and when building the app nothing appeared in Errors. Killed a day and would have wasted even more time but your suggestion on the verbosity output level was and will be immensely helpful.
  • Bhavin Patel
    Bhavin Patel over 6 years
    Hello @Chad I have just create fresh project in xamarin and I dont even touch any class or file and also I have checked there is no any "-" in filename and getting error like "The file "obj\Debug\android\bin\packaged_resources" does not exist." Thanks in advance.