问题
I just started working on cocos2d-x to build games. I have completed setup. I am getting below error when I run "HelloCpp" sample.
(skipping file '.gitignore' due to ANDROID_AAPT_IGNORE pattern '.*')
Unable to add 'C:\cocos2d-x-2.2.1\samples\Cpp\HelloCpp\proj.android\assets\fonts\Marker Felt.ttf': Zip add failed
ERROR: unable to process assets while packaging 'C:\cocos2d-x-2.2.1\samples\Cpp\HelloCpp\proj.android\bin\resources.ap_'
ERROR: packaging of 'C:\cocos2d-x-2.2.1\samples\Cpp\HelloCpp\proj.android\bin\resources.ap_' failed
Kindly help me to fix this issue.
Thanks.
回答1:
This problem has multiple solutions and I tried each one of them, and the last one worked properly. I am giving you the exact steps I took to get it work for me.
1.Check if Cygwin has the neccessary packages, if not install them. The following packages are required -
autoconf, automake, binutils, gcc-core, gcc-g++, gcc4-core, gcc4-g++, gdb, pcre, pcre-devel, gawk, make
(I skipped gcc4-core and gcc4-g++)
2.Tried renaming Marker Felt.ttf to remove the space, however since it gets regenerated, I searched for the file in all of my C: drive and renamed it everywhere.
3.Then I ran Eclipse in Administrator mode.
4.I was getting the same error although only once this time. So I changed the permission of the Asset folder in the build_native.sh itself. Just add the following line at the end of your build_native.sh file.(Taken from here)
chmod 777 -R "$APP_ANDROID_ROOT"/assets
and voila, it worked. I am not sure which one of the step was not required so I put everything here. I am guessing that running eclipse in admin mode was not required, since I can work now in normal mode too. Just in case you get into same problem you can try running it in admin mode.
来源:https://stackoverflow.com/questions/20744119/unable-to-process-assets-while-packaging-cocos2d-x-android