Update: We need help testing v3.17 (it's only a few weeks away)

@CrazyHappyGame what’s the issue? Could you please describe it in more detail? I will ask @drelaptop help to check it. Thanks.

  1. It fails for i.e.
    cocos gen-libs -p android -m release --ap android-15 --app-abi armeabi-v7a
  2. We do not know how to use Android gen-libs

@zhangxm in my previous post I described all problems 1,2,3,4. Very strange why you asking which problems…

However, it is obvious that prebuilt feature is ignored. @CrazyHappyGame I think only if someone else, who know android very good, like @mozartalouis, will do this and save the world of prebuilt’s :smiley:

Let me take a look at how we can improve and make sure everything is working as expected. I’ll get back by tonight my time.

One thing I will say is that I will try to find a solution that works through android studio since from what I’ve heard, cocos console will be deprecated soon.

@zhangxm @slackmoehrle Correct me if I am wrong about coocs console being deprecated

I don’t think cocos console is being deprecated. I think what you might mean is that Android development via the command-line has been deprecated and now proj.android is an Android Studio project.

@mozartalouis A bit updates - https://github.com/cocos2d/cocos2d-x/pull/18154

So [CMake] One build system to rule them all. Because cross-platform libs need cross-platform build systems for prebuilts I hope cmake will be used in near future…

Update: V3.17 is a few weeks away.

1 Like

Found problem: “cocos gen-libs” does not work for latest commit 9275dda539d61e4a1ca9fba48ae53becff35d047

20:09:58 g:\j\A>cocos gen-libs -p android -m release --ap android-15 --app-abi armeabi-v7a:x86 
20:09:58 running: 'g:\j\A\external\cocos2d-x\tools/cocos2d-console/bin\cocos.bat compile -s g:\j\A\external\cocos2d-x\tests/cpp-empty-test -p android --mode release --app-abi armeabi-v7a:x86 --ap android-15'
20:09:58 
20:10:00 Building mode: release
20:10:00 Using Android Studio project : g:\j\A\external\cocos2d-x\tests\cpp-empty-test\proj.android
20:10:00 Building apk...
20:10:00 Please input the absolute/relative path of '.keystore' file:
20:10:00 Traceback (most recent call last):
20:10:00   File "g:\j\A\external\cocos2d-x\tools\cocos2d-console\bin\/cocos.py", line 1072, in <module>
20:10:00     run_plugin(command, argv, plugins)
20:10:00   File "g:\j\A\external\cocos2d-x\tools\cocos2d-console\bin\/cocos.py", line 961, in run_plugin
20:10:00     plugin.run(argv, dependencies_objects)
20:10:00   File "g:\j\A\external\cocos2d-x\tools\cocos2d-console\plugins\plugin_compile\project_compile.py", line 1519, in run
20:10:00     self.build_android()
20:10:00   File "g:\j\A\external\cocos2d-x\tools\cocos2d-console\plugins\plugin_compile\project_compile.py", line 537, in build_android
20:10:00     self.apk_path = builder.do_build_apk(build_mode, self._no_apk, output_dir, self._custom_step_args, self._ap, self)
20:10:00   File "g:\j\A\external\cocos2d-x\tools\cocos2d-console\plugins\plugin_compile\build_android.py", line 555, in do_build_apk
20:10:00     self._gather_sign_info()
20:10:00   File "g:\j\A\external\cocos2d-x\tools\cocos2d-console\plugins\plugin_compile\build_android.py", line 587, in _gather_sign_info
20:10:00     inputed = self._get_user_input(MultiLanguage.get_string('COMPILE_TIP_INPUT_KEYSTORE'))
20:10:00   File "g:\j\A\external\cocos2d-x\tools\cocos2d-console\plugins\plugin_compile\build_android.py", line 617, in _get_user_input
20:10:00     ret = raw_input()
20:10:00 EOFError: EOF when reading a line
20:10:00 Error running command, return code: 1.

I get further than you, but I am using android-22

BUILD SUCCESSFUL in 8m 3s
54 actionable tasks: 25 executed, 29 up-to-date
Move apk to /Users/dubb/Cocos/cocos2d-x/tests/cpp-empty-test/bin/debug/android
Build succeed.
Traceback (most recent call last):
  File "/Users/dubb/Cocos/cocos2d-x/tools/cocos2d-console/bin/cocos.py", line 1072, in <module>
    run_plugin(command, argv, plugins)
  File "/Users/dubb/Cocos/cocos2d-x/tools/cocos2d-console/bin/cocos.py", line 961, in run_plugin
    plugin.run(argv, dependencies_objects)
  File "/Users/dubb/Cocos/cocos2d-x/tools/cocos2d-console/plugins/plugin_generate/gen_libs.py", line 79, in run
    self.compile()
  File "/Users/dubb/Cocos/cocos2d-x/tools/cocos2d-console/plugins/plugin_generate/gen_libs.py", line 176, in compile
    self.compile_android()
  File "/Users/dubb/Cocos/cocos2d-x/tools/cocos2d-console/plugins/plugin_generate/gen_libs.py", line 368, in compile_android
    cocos.copy_files_with_config(copy_cfg, obj_dir, android_out_dir)
  File "/Users/dubb/Cocos/cocos2d-x/tools/cocos2d-console/bin/cocos.py", line 799, in copy_files_with_config
    src_dir, src_dir, dst_dir, include_rules, exclude_rules)
  File "/Users/dubb/Cocos/cocos2d-x/tools/cocos2d-console/bin/cocos.py", line 818, in copy_files_with_rules
    for name in os.listdir(src):
OSError: [Errno 2] No such file or directory: '/Users/dubb/Cocos/cocos2d-x/tests/cpp-empty-test/proj.android/app/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a:x86'

It seems, that you can’t use two ABIs in one command. Your error tries to find a weird folder.

1 Like

You are correct. building for just one works for me.

It seems like incorrect version is compiled: I see “debug” but there is option “-m release”

1 Like

Have you created any GitHub issues for this yet?

@slackmoehrle Are you sure that:

  1. you are running “cocos gen-libs -p android -m release --ap android-15 --app-abi armeabi-v7a:x86”. With -m release
  2. you have latest cocos2d-x with latest tools/cocos2d-console?
  3. you have latest ndk-16b

I just cloned latest cocos2d-x in clean environment and have following error

g:\cocos_latest\subrepos\repos>cocos gen-libs -p android -m release --ap android-15 --app-abi armeabi-v7a:x86
running: 'g:\cocos_latest\subrepos\external\cocos2d-x\tools/cocos2d-console/bin\cocos.bat compile -s g:\cocos_latest\subrepos\external\cocos2d-x\tests/cpp-empty-test -p android --mode release --app-abi armeabi-v7a:x86 --ap android-15'

Building mode: release
Using Android Studio project : g:\cocos_latest\subrepos\external\cocos2d-x\tests\cpp-empty-test\proj.android
Building apk...
Please input the absolute/relative path of '.keystore' file:

without “-m release” I have similar error to your:
“cocos gen-libs -p android -m release --ap android-15 --app-abi armeabi-v7a:x86”

Move apk to g:\repos\cocos2d-x\tests\cpp-empty-test\bin\debug\android
Build succeed.
Traceback (most recent call last):
  File "g:\repos\cocos2d-x\tools\cocos2d-console\bin\/cocos.py", line 1072, in <module>
    run_plugin(command, argv, plugins)
  File "g:\repos\cocos2d-x\tools\cocos2d-console\bin\/cocos.py", line 961, in run_plugin
    plugin.run(argv, dependencies_objects)
  File "g:\repos\cocos2d-x\tools\cocos2d-console\plugins\plugin_generate\gen_libs.py", line 79, in run
    self.compile()
  File "g:\repos\cocos2d-x\tools\cocos2d-console\plugins\plugin_generate\gen_libs.py", line 176, in compile
    self.compile_android()
  File "g:\repos\cocos2d-x\tools\cocos2d-console\plugins\plugin_generate\gen_libs.py", line 368, in compile_android
    cocos.copy_files_with_config(copy_cfg, obj_dir, android_out_dir)
  File "g:\repos\cocos2d-x\tools\cocos2d-console\bin\cocos.py", line 799, in copy_files_with_config
    src_dir, src_dir, dst_dir, include_rules, exclude_rules)
  File "g:\repos\cocos2d-x\tools\cocos2d-console\bin\cocos.py", line 818, in copy_files_with_rules
    for name in os.listdir(src):
WindowsError: [Error 267] The directory name is invalid: 'g:\\repos\\cocos2d-x\\tests/cpp-empty-test\\proj.android/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a:x86/*.*'

@CrazyHappyGame

Yes.

Yes

I am using Android-22, not Android-15, however

@slackmoehrle Below prove that in clean env (CI Linux/Windows VM) it fails:


https://travis-ci.org/cocos2d/cocos2d-x/jobs/370779819
https://ci.appveyor.com/project/minggo/cocos2d-x/build/job/ewmuivdbc3dtpydt

It might fail with Android-15, but it doesn’t fail for Android-22. But we should still probably fix.

It fails with android-22 (and any other android api) on my clean PC and in our Linux/Windows CI. Please check the same pull request:
https://travis-ci.org/cocos2d/cocos2d-x/jobs/370900161
https://ci.appveyor.com/project/minggo/cocos2d-x/build/1.0.952/job/9k9lrojd3la45u58
I will check macOS in few hours …

The error message is “Please input the absolute/relative path of ‘.keystore’ file:” You should check the gradle.properties file in the proj.android folder.

@mars3142 I know how to fix such kind of error for my game.
But below command should just create cocos2d-x prebuild version. I do not understand why right now we build “cocos2d-x/tests/cpp-empty-test”. But yes, most probably gradle.properties should be updated for “cocos2d-x/tests/cpp-empty-test” to fix error in gen-libs:

cocos gen-libs -p android -m release --ap android-15 --app-abi armeabi-v7a:x86