IOError building apk

I am still trying to upgrade a cocos2d-x 3.4 to cocos2d-x 3.5 project. We are using cocos studio 2 parser and lua. Sadly the lua runtimes were removed from 3.5 sources so i am forces to use cocos2d-x 3.5 framework (meh…).
I created a new project with 3.5 framework, copied my lua sources inside, made the changed to the cpp files because of admob and added the google play services lib to the android project in eclipse ADT.

When I am building the apk in cocos code ide the BUILD SUCCESSFUL message appears. Than, when the apk is build, following error occurs.

Traceback (most recent call last):
  File "C:\Cocos\frameworks\cocos2d-x-3.5\tools\cocos2d-console\bin\cocos.py", line 859, in <module>
    run_plugin(command, argv, plugins)
  File "C:\Cocos\frameworks\cocos2d-x-3.5\tools\cocos2d-console\bin\cocos.py", line 817, in run_plugin
    plugin.run(argv, dependencies_objects)
  File "C:\Cocos\frameworks\cocos2d-x-3.5\tools\cocos2d-console\plugins\project_compile\project_compile.py", line 1432, in run
    self.build_android()
  File "C:\Cocos\frameworks\cocos2d-x-3.5\tools\cocos2d-console\plugins\project_compile\project_compile.py", line 440, in build_android
    self.apk_path = builder.do_build_apk(sdk_root, ant_root, build_mode, output_dir, self._custom_step_args, self)
  File "C:\Cocos\frameworks\cocos2d-x-3.5\tools\cocos2d-console\plugins\project_compile\build_android.py", line 409, in do_build_apk
    shutil.copy(gen_apk_path, output_dir)
  File "C:\Cocos\tools\Python27\lib\shutil.py", line 119, in copy
    copyfile(src, dst)
  File "C:\Cocos\tools\Python27\lib\shutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: u'C:\\Cocos\\Development\\Game\\frameworks\\runtime-src\\proj.android\\bin\\SpaceSpy-debug.apk'

any ideas?

BTW: I want the 3.5 sources WITH lua runtimes back ^^ The update process with cocos code ide was so easy and now it’s made worser :confused:

Hello.
I have a similar problem. But I’m using C ++.
I’m creating a new project and get this when try to compile it into eclipse

building apk
Please input the absolute/relative path of ".keystore" file:
Traceback (most recent call last):
  File "D:\cocos2d-x-3\tools\cocos2d-console\bin\/cocos.py", line 859, in <module>
    run_plugin(command, argv, plugins)
  File "D:\cocos2d-x-3\tools\cocos2d-console\bin\/cocos.py", line 817, in run_plugin
    plugin.run(argv, dependencies_objects)
  File "D:\cocos2d-x-3\tools\cocos2d-console\plugins\project_compile\project_compile.py", line 1432, in run
    self.build_android()
  File "D:\cocos2d-x-3\tools\cocos2d-console\plugins\project_compile\project_compile.py", line 440, in build_android
    self.apk_path = builder.do_build_apk(sdk_root, ant_root, build_mode, output_dir, self._custom_step_args, self)
  File "D:\cocos2d-x-3\tools\cocos2d-console\plugins\project_compile\build_android.py", line 382, in do_build_apk
    self._gather_sign_info()
  File "D:\cocos2d-x-3\tools\cocos2d-console\plugins\project_compile\build_android.py", line 429, in _gather_sign_info
    inputed = self._get_user_input("Please input the absolute/relative path of \".keystore\" file:")
  File "D:\cocos2d-x-3\tools\cocos2d-console\plugins\project_compile\build_android.py", line 458, in _get_user_input
    ret = raw_input()
EOFError: EOF when reading a line
Please use cocos console instead.

Traceback (most recent call last):
  File "D:/Simple4/proj.android/build_native.py", line 43, in <module>
    build(opts.build_mode)
  File "D:/Simple4/proj.android/build_native.py", line 28, in build
    raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")
Exception: Build dynamic library for project [ D:\Simple4\proj.android\../ ] fails!

I use cocos2d-x-3.5 from git and ndk-r10d.

@Michael Have you tried to compile the new not modified project?

I am only building it with cocos code ide which is using cocos console i think. Yeah, a new project works. What really freaks me out is that I created a fully new project, did the modifications and… it works -_- so yeah, no idea…

I also have no idea.
after several hours of experimentation, I could not run an empty project.
I notice that the status of the build for android is fail on the githab. maybe the problem is happening on here.

Are you using eclipse to build the game? if so, switch to cocos console :stuck_out_tongue_winking_eye:

cocos run -p android

in the directory of the project.

1 Like

Thank you for your concern :sunny:

I tried the console, but with the same result.

Now I downloaded the new version of cocos from githab… and it works fine.
and I am also able to use eclipse to build now.
It seems that the problem was in a bad build.

But I really appreciate your help :sweat_smile:

Hello,

I have same problem.
Can you send me the link, which version did you download?

Thanks.

Hello Mikho,

I downloaded the latest version from here.
The cocos console can not be downloaded together with the main archive. You can download console here, and then unzip it to the folder \cocos2d-x-3\tools\cocos2d-console.

Thank you, I will try.

I decided this problem on mac. Need to set property in /proj.android/ant.properties:
key.alias.password=<pass>
key.store.password=<pass>
key.store=/Users/<username>/.android/<keystroke file>
key.alias=<keystroke alias>

I had this exact same problem today when moving a compilation from android to android-studio.

The problem, for future reference, is that the script is looking for the built apk file in:
proj.android\\bin\\SpaceSpy-debug.apk

but it’s actually being built in:
proj.android\\bin\\debug\\SpaceSpy-debug.apk

Which is why it can’t find it.
The workaround we used was to fix the build script build_android.py lines 663-665 so that it looked in the right folder.

   # copy the apk to output dir
    if output_dir:
        apk_name = '%s-%s.apk' % (project_name, build_mode)

becomes

   # copy the apk to output dir
    if output_dir:
        apk_name = '%s\\%s-%s.apk' % (build_mode, project_name, build_mode)

I realise this is far too late to help the original poster, but it might help other people with the same problem (it would have helped me!)