cocos2d / cocos2d-console

cocos2d command line tool
152 stars 190 forks source link

support for building Android app bundle #471

Open nasimafeef opened 4 years ago

vyshnavsdeepak commented 4 years ago

@minggo

minggo commented 4 years ago

I will test it later.

minggo commented 4 years ago

cocos run -p android -m debug-bundle will crash, the crash log is

Traceback (most recent call last):
  File "/Users/minggo/sourcecode/cocos2d-x-v3/tools/cocos2d-console/bin/cocos.py", line 1081, in <module>
    run_plugin(command, argv, plugins)
  File "/Users/minggo/sourcecode/cocos2d-x-v3/tools/cocos2d-console/bin/cocos.py", line 967, in run_plugin
    dep_name, argv, plugins)
  File "/Users/minggo/sourcecode/cocos2d-x-v3/tools/cocos2d-console/bin/cocos.py", line 967, in run_plugin
    dep_name, argv, plugins)
  File "/Users/minggo/sourcecode/cocos2d-x-v3/tools/cocos2d-console/bin/cocos.py", line 970, in run_plugin
    plugin.run(argv, dependencies_objects)
  File "/Users/minggo/sourcecode/cocos2d-x-v3/tools/cocos2d-console/plugins/plugin_compile/project_compile.py", line 1532, in run
    self.build_android()
  File "/Users/minggo/sourcecode/cocos2d-x-v3/tools/cocos2d-console/plugins/plugin_compile/project_compile.py", line 542, in build_android
    self.apk_path = builder.do_build_apk(build_mode, self._no_apk, self._no_sign, output_dir, self._custom_step_args, self._ap, self, self._bundle)
  File "/Users/minggo/sourcecode/cocos2d-x-v3/tools/cocos2d-console/plugins/plugin_compile/build_android.py", line 572, in do_build_apk
    shutil.copy(gen_apk_path, output_dir)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 119, in copy
    copyfile(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: u'/Users/minggo/sourcecode/cocos2d-x-v3/tests/cpp-empty-test/proj.android/app/build/outputs/apk/debug/CppEmptyTest-debug.apk'

It is because it only generate bundle, but doesn't generate APK. And cocos run will try to install apk on device and run it.

nasimafeef commented 4 years ago

@minggo