lately I am getting this error from eclipse: "invalid resource directory name", resource "crunch", type "Android AAPT Problem" what is this problem and how to solve it?
13 Answers
Fix:
from the menu click Project->Clean...
a popup window will appear. select the check box for the project that is making this issue then click OK.
wait and see, that is it.
-
4Does anybody else have the experience that, like, you are constantly having to rebuild or clean or manually build or whatever, when using ADT on Eclipse? Is the project I'm on just hopelessly screwed up, or is ADT/Eclipse hopelessly screwed up? Anyway, yeah, YET ANOTHER problem in Eclipse solved by a make clean... Dec 4, 2013 at 18:39
-
2
-
2@user435779 The Ant build process for Android is just hopelessly screwed up. Jul 9, 2014 at 20:55
-
1Does not work. And deleting the crunch file (as suggested elsewhere); the file just reappears.– ajbrausJul 10, 2014 at 21:13
-
12If you are running ant from command line use command 'ant clean release' instead of just 'ant release'. If you are using eclipse disable autobuild delete crunch folder and then execute ant more info : pissedoff-techie.blogspot.in/2014/07/… Jul 17, 2014 at 8:39
Ant
and the ADT
Plugin for Eclipse are packing the .apk
file in a different build chain and temp generation folders. Crunch
is created by the ADT
. Best to do is to start every step with a clean
if you switch between the tools. use ant clean
if you used the ADT
from eclipse before. Use Projects -> clean ...
in Eclipse if you used ant
before. Hope this solves your problem. Also restarting Eclipse could help.
-
4I was trying to build with
ant
while the project was open in Eclipse. Quitting Eclipse fixed the problem.– jabFeb 5, 2014 at 16:02 -
using
ant clean
on my main project and its referenced library projects did the trick Apr 17, 2014 at 13:57
I had the same issue: invalid resource directory name: D:\work\merge\Client_2_24\Client\bin\res/crunch. I tried Project->Clean but didn't work. Then I directly deleted the directory crunch and it worked :)
This problem is resulting of and Android requirement that in res
folder only can have drawable
, drawable-xhdpi
, and so on. crunch
is not one of this.
It's commented here.
-
Do you know why I might be getting the same "Error: Invalid resource directory name" with drawable-xxxxhdpi? Oct 6, 2015 at 17:22
-
Thanks @Toni. This was the fix for me. I was trying to use 'res/assets' for my resources. I changed it to 'res/drawable' and it worked like a charm after cleaning and rebuilding.– szMuzzyAOct 19, 2019 at 15:51
First of all, I find that this annoyance manifests itself when alternating between building my code in Eclipse and building it via ant
on the command line.
The solutions that involve cleaning the project(s) are fine, however, my source tree takes more than 5 minutes to build given the fact that much of the code makes heavy use of templates. I try to avoid cleaning whenever possible to keep from having to do a complete rebuild. So here's my solution:
Add the following to build.xml:
<target name="-pre-build">
<delete>
<fileset dir="${basedir}" includes="**/crunch/**"/>
</delete>
</target>
This delete task in ant
will recursively remove all crunch
directories beneath the directory where the build.xml file is located. This task will run whenever I do an ant debug/release
on the command line, which means I'll never have to clean my project as a result of this crunch nonsense again!
I could solve this issue by doing "ant clean debug". The above suggestions of cleaning the project from Eclipse didn't work for me.
If you don't want to use eclipse and get this error message with ant release -Dsdk.dir=$SDK_ROOT
, you can just run ant clean -Dsdk.dir=$SDK_ROOT
This happened to me when I incorrectly imported a project to eclipse using "New Project ->Android Project from Existing Code". It caused the crunch directory to turn up somewhere unexpected. Importing using "Import -> Exising Projects into Workspace" solved it.
create a file called ant.properties in the folder where your manifest file is. add aapt.ignore.assets=crunch:(whatever the default values are in your android sdk/tools/ant/build.xml file commented above the property )
when using cordova from the command line it uses ant when using eclipse it uses android package manager
package manager compresses the png files and puts them into crunch, crunch is an invalid folder name for ant, if eclipse is set to build automatically, everytime u delete crunch it will be built again by the android package manager. you can test this by right click project, propteries, builders, unchecking android package manager, deleting crunch folder, and it will never come back again, you will also never have compressed png files again.
deleting the folder without doing any of these things and with eclipse open is just rolling the dice, will eclipse auto generate the crunch before cordova gets to the package-resource stage
-
Yes, a thousand times yes. Just include the crunch directory in the default filter. Yes. Jul 18, 2017 at 16:56
when I updated android SDK build tools to version 18 and 19, I had the same issue.
My solution is:
- go to google service library project - properties - builders - uncheck all builders
- delete all the files under bin folder
- run ant task to clean this project.
I believe the problem was that eclipse would build automatically, and generate files that are conflicted with ant build.
First of all try to Clean your project. If it works then well and good otherwise move into the bin -> res -> there is one folder named Crunch. Just delete that folder directly and clean the project again.
It will solve the problem.
while my error is
Error:Execution failed for task ':app:mergeDebugResources'. /path/to/project/app/src/main/res/drawable-xxdpi: Error: Invalid resource directory name
notice "drawable-xxdpi" is not valid folder name, while "drawable-xxhdpi" is right.
Some of yours folders' names might not be allowed by the Android standard: check the folders you made, and rename them.
-
Referencing the standard, maybe even offering examples of disallowed folder names is in order here.– J0e3ganDec 19, 2014 at 3:01