Android App Compile Not Generating Package Resources
Asked Answered
C

22

40

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
Clubwoman answered 30/8, 2015 at 2:23 Comment(0)
F
48

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.

Fir answered 15/9, 2015 at 15:17 Comment(2)
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.Courser
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.Rubberneck
T
18

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_.]

Trellas answered 14/4, 2016 at 19:47 Comment(0)
S
17

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.

Santoyo answered 20/11, 2015 at 11:23 Comment(3)
Thanks a lot. With your solution I immediately found one of my resources with an invalid filename (also a hyphen character in the filename).Penniepenniless
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".Weide
Thanks for the tip, I'll modify the answer.Santoyo
L
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.

Licketysplit answered 26/4, 2016 at 14:54 Comment(1)
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.Undershorts
F
5

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

Fructuous answered 16/6, 2016 at 0:35 Comment(1)
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.Landers
H
4

Another possibility is you have an issue with the installed Android SDK build tools. For me, when I removed the package for Revision 24 it worked.

Hearsay answered 16/6, 2016 at 13:43 Comment(0)
P
2

From Xamarin Forums:

First of all go and deinstall preview tools in your android sdk manager. If you havent installed it but still get the same error then go and deinstall Android SDK Build Tools Rev. 24.

The Problem we have here is that, if you have Appcombat, RecyclerView or something like that in your project, the library rev of these librarys are below rev 24. They are still on 23.2.1 but not on rev 24. So if you installed Build-Tools Rev 24 and want to build your project the build cant find the rev24 resource package of your librarys.

You can check it on your own Go in the SDK Manager and check "Obsolete" Then go to the folder Extras and there you can see "Android Support Library (Obsolete) Rev 23.2.1. And then check if there is Android Support Library Rev 24 in your Extras Folder. No? And thats the Problem here. We got the Update for Build Tools to early and have to wait for Library Update. Then we all can use Build Tools 24!

So only update to BuildTools Rev 24 when we got an update for support librarys and have the rev24 librarys.

Pallid answered 8/7, 2016 at 7:58 Comment(0)
T
1

Basically the problem is with special character of Resource FILE NAME. In my case, I am keep getting error "The file "obj\Debug\android\bin\packaged_resources" does not exist.":

..\Resources\drawable\company-app-log.png having -(hyphen) between alpha characters is the root-cause of the issue.

Tressietressure answered 14/8, 2016 at 7:4 Comment(0)
M
1

Using Xamarin Studio here -

Sometimes this is caused by AXML errors.

Which if you turn on detailed / diagnostic in preferences you can search the build output (or your packaging output) for the word ERROR.

enter image description here

For example, somebody checked in some AXML line(s) with -

android:Text="something"

and the uppercase T was causing this error -

Resources/layout/Somefile.axml(11): error APT0000: No resource identifier found for attribute 'Text' in package 'android'

Fixing the errors fixed the original message.

Messing answered 2/5, 2017 at 5:32 Comment(0)
I
0

Firstly, i suggest you change "show out put from" Build to Xamarin to see the real error and its details as seen in my case

At first

At first the error wasnt clear

And then After changing output to Xamarin please make sure you installed your NDK properly. That was the issue with mine,

and please make sure the NDK directory is also set

hope this helps someone

Inexplicit answered 18/5, 2016 at 10:28 Comment(0)
E
0

I just lost 7 hours of my day.. You know what I did?

Project.Droid -> Resources -> RightClick on the Resource.Designer.cs -> Delete

I did fu****n' works ! ><

EDIT

Omg it did comes back... Why does Windows has all time so much of bugs... seriously..

Euclid answered 9/6, 2016 at 15:30 Comment(0)
E
0

Same annoying problem with me! But I found a solution: read carefully this article: https://gxconsultancy.wordpress.com/2016/04/04/to-use-xamarin-or-not-to-us-xamarin/

In short:

  • Make sure you have JDK 32bits version 8 at least - same for the JRE, included in the JDK installation kit from Oracle;

  • Set your project for using the Xamarin debugger (right-click your project, hit Properties / Android Options / Packaging / Debugger);

  • And now the most weird: delete the app/Resources/drawable folder; have a working Xamarin project and copy its "drawable" folders to the erratic project (usually there are several subfolders, like drawable-hdpi, drawable-mdpi and so fort).

  • Rebuild your Android project.

Eveliaevelin answered 20/6, 2016 at 14:51 Comment(1)
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.Ilo
E
0

I had the problem so I deleted build-tools 24.0.0 and I used build-tools 23.0.3 and the problem solved. Try it!

Easy answered 13/11, 2016 at 6:27 Comment(0)
S
0

make sure that your resources don't have any special character or start with number

Seel answered 25/3, 2017 at 8:29 Comment(0)
H
0

Encountered same issue in VS 2015 and Xamarin 7.2.0.7. In my case, the issue happened just suddenly, and turned out the issue caused by wrong element name in axml, traced using Tiago's answers above.

So I didn't find the line Tiago mentioned with aapt.exe, but I then I tried to search for keyword failed in output. Then I found one telling me about margin. In android, margin is set using android:layout_margin. I played with element and forgot and put android:margin instead, thus also why it happened so sudden after so many successful run. Fixed it and the build succeeded.

Helmet answered 7/4, 2017 at 7:9 Comment(0)
B
0

In my case the error was caused because I set the version number in the manifest to 1.0. Apparently the version number must be an integer.

Breechcloth answered 11/4, 2017 at 9:54 Comment(0)
F
0

Had the same problem. My error was in the manifest: I had Version Code (Version number) set at "1.0.0" and it wasn't allowed. It only takes integers so I had to revert to "1".

I mixed up Version Code and Version Name.

Fund answered 11/4, 2017 at 15:50 Comment(0)
L
0

For me this error was caused by having an invalid attribute value in a layout xml. I had

android:id="button"

changing it to

android:id="@+id/button"

fixed the error.

Lachman answered 21/4, 2017 at 8:47 Comment(0)
M
0

Not sure if this is a late answer, but this specific error message occurs for one of the two reasons:

  1. (Most probably the case): In your layout file, you may have mentioned a resource (drawable/image) incorrectly. For example, the image was in the mipmap folder path but you have pointed it wrongly to the drawable folder path.

  2. Per many comments, there could be a hyphen or special character in one your resources' names or it starts with a number. However, please note, in this specific case, you will mostly see a aapt.exe has stopped or appt.exe has exited with error code 1 error. I am not sure if you will get obj\Debug\android\bin\packaged_resources not found error. My experience says that point 1 above is the case.

Mnemosyne answered 8/5, 2017 at 9:19 Comment(0)
M
0

Got this error in Visual Studio 2017 Xamarin android project on Windows. After lot of experiments with resource's files I found, that filename length and extension of image file in the drawable folder affect the result of compillation!

drawable/abcde.png - compilled ok
drawable/abcdef.png - error, "obj\Debug\android\bin\packaged_resources" does not exist

If rename image to file without .png extension, compilled without errors.

Spended a lot of time and was confused :-/

Millihenry answered 5/7, 2017 at 11:40 Comment(0)
P
0

I had the same problem. To solve I had to remove all nuget packages from droid project, and reinstalled xamarin.forms again (has to be same version used in other projects).

Photoflash answered 6/7, 2017 at 10:7 Comment(0)
W
0

had the same issue. This was because i had an .png file that had a "-" character in it's name. Just enusure any of your resources don't have the "-" hyphen character

Wolfy answered 26/12, 2017 at 14:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.