Cocos2D-x HelloCpp for Android unable to build apk from Windows due to permission denied on asset file

青春壹個敷衍的年華 提交于 2019-12-07 07:28:57

问题


I was trying to run cocos2dx HelloCpp sample project on Android, building from Windows-7 64 bit with Cygwin 64 bit, however, everytime I try to build and run, it complains that permission was denied on "Marker Felt.fnt" file in assets/font folder.

I checked that there's no permission on that file and chmod to give it proper permission, but everytime I try to run again, that file seems to be regenerated and has no permission again...

Does anyone has the same problem? I have been googling and the nearest problem I've found is this:

Cocos2dx Android: Get data from file(assets/*) failed

However, it is quite different. I've tried disabling UAC on my Windows machine, but the problem doesn't go away

Any help is highly appreciated


回答1:


Check the proj.android/build_native.sh, every time you run the build, the entire assets/* folder will be re-created, and thus, your chmod is nullified.

You can chmod after the copy process itself in the build_native.sh, place the chmod somewhere after cp the assets/*

in my case, put

chmod 777 -R "$APP_ANDROID_ROOT"/assets 

after copying the assets folder in build_native.sh like this:

if [ -f "$file" ]; then
    cp "$file" "$APP_ANDROID_ROOT"/assets
fi

chmod 777 -R "$APP_ANDROID_ROOT"/assets
done


来源:https://stackoverflow.com/questions/18050481/cocos2d-x-hellocpp-for-android-unable-to-build-apk-from-windows-due-to-permissio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!