-1

I run a cocos2dx to generate an APK file, but it throws out this error

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

Any idea what could be the issue?

Moses Liao GZ
  • 1,556
  • 5
  • 20
  • 45

1 Answers1

-1

You should use Android Studio (instead of run the python function to call ANT) to build the project to apk. It's far easier use, trace error and debug.

about your question:
/project/Cocos2dx/proj.android-studio/app/build/outputs/apk/Cocos2dx-debug.apk this path is belong to project Android Studio. In my experience, when using the cocos console command, it use proj.android instead of proj.android-studio

  • Why someone vote down my answer? **This is the right answer**. In the version you are using, the person write the cocos command has forgotten to replace `proj.android-studio` by `proj.android` in the final command: **open the built folder**. The .apk has built successfully, you just open the folder yourself. – Khang Dinh Hoang Oct 10 '18 at 11:30