cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.29k stars 7.05k forks source link

Change debug apk path #18506

Open giangm9 opened 7 years ago

giangm9 commented 7 years ago
  1. create a new cocos project
  2. cocos run -p android --android-studio
  3. Traceback (most recent call last):
    File "/home/gl/tools/cocos2d-x-3.16/tools/cocos2d-console/bin/cocos.py", line 1072, in <module>
    run_plugin(command, argv, plugins)
    File "/home/gl/tools/cocos2d-x-3.16/tools/cocos2d-console/bin/cocos.py", line 958, in run_plugin
    dep_name, argv, plugins)
    File "/home/gl/tools/cocos2d-x-3.16/tools/cocos2d-console/bin/cocos.py", line 958, in run_plugin
    dep_name, argv, plugins)
    File "/home/gl/tools/cocos2d-x-3.16/tools/cocos2d-console/bin/cocos.py", line 961, in run_plugin
    plugin.run(argv, dependencies_objects)
    File "/home/gl/tools/cocos2d-x-3.16/tools/cocos2d-console/plugins/plugin_compile/project_compile.py", line 1646, in run
    self.build_android()
    File "/home/gl/tools/cocos2d-x-3.16/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 "/home/gl/tools/cocos2d-x-3.16/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 133, in copy
    copyfile(src, dst)
    File "/usr/lib/python2.7/shutil.py", line 96, in copyfile
    with open(src, 'rb') as fsrc:
    IOError: [Errno 2] No such file or directory: '/home/gl/projects/altp-gl/proj.android-studio/app/build/outputs/apk/altp-gl-debug.apk'
  4. I modified file "/home/gl/tools/cocos2d-x-3.16/tools/cocos2d-console/plugins/plugin_compile/project_compile.py", line 607, change
    gen_apk_folder = os.path.join(self.app_android_root, 'app/build/outputs/apk')

    to

    gen_apk_folder = os.path.join(self.app_android_root, 'app/build/outputs/apk/debug')

    and it run successfuly

madebymozart commented 7 years ago

I am working on a PR right now to mane cocos handle prebuilts with Android much better for the future and hopefully 3.17