Python无法检测文件,抛出错误

时间:2018-06-15 07:55:26

标签: cocos2d-x cocos2d-android

我运行cocos2dx来生成一个APK文件,但它会抛出此错误

BUILD SUCCESSFUL in 7m 49s
54 actionable tasks: 3 executed, 51 up-to-date
Traceback (most recent call last):
  File "/cocos2dx/tools/cocos2d-console/bin/cocos.py", line 1072, in <module>
    run_plugin(command, argv, plugins)
  File "/cocos2dx/tools/cocos2d-console/bin/cocos.py", line 961, in run_plugin
    plugin.run(argv, dependencies_objects)
  File "/cocos2dx/tools/cocos2d-console/plugins/plugin_compile/project_compile.py", line 1646, in run
    self.build_android()
  File "/cocos2dx/tools/cocos2d-console/plugins/plugin_compile/project_compile.py", line 581, in build_android
    self.apk_path = builder.do_build_apk(build_mode, self._no_apk, output_dir, self._custom_step_args, self._ap, self)
  File "/cocos2dx/tools/cocos2d-console/plugins/plugin_compile/build_android.py", line 669, in do_build_apk
    shutil.copy(gen_apk_path, output_dir)
  File "/usr/lib/python2.7/shutil.py", line 119, in copy
    copyfile(src, dst)
  File "/usr/lib/python2.7/shutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: '/project/Cocos2dx/proj.android-studio/app/build/outputs/apk/Cocos2dx-debug.apk

知道可能是什么问题吗?

1 个答案:

答案 0 :(得分:-1)

您应该使用Android Studio(而不是运行python函数来调用ANT)来构建项目到apk。它更容易使用,跟踪错误和调试。

关于你的问题:
/project/Cocos2dx/proj.android-studio/app/build/outputs/apk/Cocos2dx-debug.apk 此路径属于项目Android Studio。根据我的经验,当使用cocos控制台命令时,它使用proj.android而不是proj.android-studio