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?
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.
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.
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.
https://stackoverflow.com/a/7168818/2411379
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With