登录
  • 欢迎访问 Sharezer Blog

Cocos 运行build_native.py 编译Android时,[Error5]

Cocos sharezer 2038次浏览 已收录 0个评论

Cocos2d-x 3.0 以后,运行build_native.py 直接编译打包apk。

build_native.py会将Resources中的内容直接拷贝assets中,如果Resoucres有版本控制。.svn文件夹一样会被拷贝过去。

当assets目录中已经存在.svn文件夹时,就会编译报错。

所以每次运行py文件前都要先把assets清空。

也通过修改build_native.py,来达到不拷贝.svn文件夹的目的。

def copy_files(src, dst):

    for item in os.listdir(src):
        path = os.path.join(src, item)
        # Android can not package the file that ends with ".gz"
        if not item.startswith('.') and not item.endswith('.gz')  and os.path.isfile(path):
            shutil.copy(path, dst)
        if os.path.isdir(path) and not item.endswith('.svn') :
            new_dst = os.path.join(dst, item)
            os.mkdir(new_dst)
            copy_files(path, new_dst)

加入

and not item.endswith('.svn') 


Sharezer , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明Cocos 运行build_native.py 编译Android时,[Error5]
喜欢 (1)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址