IOError: [Errno 2] No such file or directory: directory...proj.android\\app/build/outputs/apk\\debug\\app-debug.apk

354 Views Asked by At

I'm new to android development and cocos2dx so need some help .at first I was trying to run the project from Android studio but the game crashed with some sort of error "couldn't find "libcocos2dcpp.so" and there was no libcocos2dcpp.so in any of my architecture folders.so someone suggested me to build the project with console first it will generate that file in architecture folder. but When I try to compile the code through console this error comes up after successfully build process and I don't get the apk file nor there is any libcocos2dcpp.so file generated.

As I'm new so please simply the answer as possible as you can. thank you so much

console log:

> BUILD SUCCESSFUL in 2m 15s 106 actionable tasks: 1 executed, 105
> up-to-date Traceback (most recent call last):   File
> "C:\Users\fahad\Desktop\envriomentsetup\cocos2d-x-3.17.2\cocos2d-x-3.17.2
> \tools\cocos2d-console\bin\/cocos.py", line 1081, in <module>
>     run_plugin(command, argv, plugins)   File "C:\Users\fahad\Desktop\envriomentsetup\cocos2d-x-3.17.2\cocos2d-x-3.17.2
> \tools\cocos2d-console\bin\/cocos.py", line 970, in run_plugin
>     plugin.run(argv, dependencies_objects)   File "C:\Users\fahad\Desktop\envriomentsetup\cocos2d-x-3.17.2\cocos2d-x-3.17.2
> \tools\cocos2d-console\plugins\plugin_compile\project_compile.py",
> line 1530, in  run
>     self.build_android()   File "C:\Users\fahad\Desktop\envriomentsetup\cocos2d-x-3.17.2\cocos2d-x-3.17.2
> \tools\cocos2d-console\plugins\plugin_compile\project_compile.py",
> line 540, 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)  
> File
> "C:\Users\fahad\Desktop\envriomentsetup\cocos2d-x-3.17.2\cocos2d-x-3.17.2
> \tools\cocos2d-console\plugins\plugin_compile\build_android.py", line
> 571, in do_build_apk
>     shutil.copy(gen_apk_path, output_dir)   File "C:\Python27\lib\shutil.py", line 139, in copy
>     copyfile(src, dst)   File "C:\Python27\lib\shutil.py", line 96, in copyfile
>     with open(src, 'rb') as fsrc: IOError: [Errno 2] No such file or directory:
> 'C:\\Users\\fahad\\Desktop\\projectsteam\\proj.android\\app/build/outputs/apk\\debug\\app-debug.apk'
1

There are 1 best solutions below

0
Developer On

I see your problem via upwork. I have see many problem of cocos2d like you. Check your project step by step:

  • Your project is using cocos version? (you can check it in file: .cocos-project.json) May be your project use old cocos version, and this case you compile it by cocos newest.
  • Check requirement of cocos2d framework: NDK version stable, sdk version, python version,...

  • Check jni in your project, make sure library was compiled name is libcoco2dcpp It locate in path: proj.android\app\jni\Android.mk. In this case it will be LOCAL_MODULE_FILENAME := libcocos2dcpp

  • Create a new hello wolrd project and try to build it. If it have problem, fix it is easy, then copy code on your project to this one by one and try recompile to find errors.

=> I have create new Helloworld project by cocos2d-x 3.17.2. Code of jni file have LOCAL_MODULE_FILENAME := libMyGame may be you are using newest cocos2d console to compile older project and cause this error