A preconfigured environment to end all compiling frustration

I had been trying to get cpp-tests to build on my machine (split abi) with various guides on this forum:

But it didn’t work for me. Spilling error messages here and there.

So obviously the configuration on my machine and others are so different that it didn’t work.

To minimize that, I downloaded a virtualbox images from osboxes.org Ubuntu_17.10_10th-August-VB-64bit.7z and setting up the environment from a clean slate:

  • android-studio-ide-162.4069837-linux.zip extracted to /home/osboxes/android-studio
  • cocos2d-x-3.14.1.zip (because 3.15.1 doesn’t allow prebuilt with gen-libs anymore) extracted to /home/osboxes/cocos2d-x-3.14.1 should still use cocos2d-x-3.15.1
  • android sdk tools 26.1.1 use android sdk tools 25.2.3 instead, platform-tools 26.0.0 (downloaded automatically by Android studio) at /home/osboxes/Android/Sdk
  • android ndk 15.2.4203891 (downloaded automatically by Android studio) at /home/osboxes/Android/Sdk/ndk-bundle
  • apache ant 1.9.9 installed via sudo apt-get install ant
  • python 2.7.14 installed via sudo apt-get install python

Here’s the result of cocos2d setup.py

Setting up cocos2d-x...
->Check environment variable COCOS_CONSOLE_ROOT
  ->Search for environment variable COCOS_CONSOLE_ROOT...
    ->COCOS_CONSOLE_ROOT is found : /home/osboxes/cocos2d-x-3.14.1/tools/cocos2d-console/bin

->Check environment variable COCOS_X_ROOT
  ->Search for environment variable COCOS_X_ROOT...
    ->COCOS_X_ROOT is found : /home/osboxes

->Check environment variable COCOS_TEMPLATES_ROOT
  ->Search for environment variable COCOS_TEMPLATES_ROOT...
    ->COCOS_TEMPLATES_ROOT is found : /home/osboxes/cocos2d-x-3.14.1/templates

->Configuration for Android platform only, you can also skip and manually edit "/home/osboxes/.bashrc"

->Check environment variable NDK_ROOT
  ->Search for environment variable NDK_ROOT...
    ->NDK_ROOT is found : /home/osboxes/Android/Sdk/ndk-bundle

->Check environment variable ANDROID_SDK_ROOT
  ->Search for environment variable ANDROID_SDK_ROOT...
    ->ANDROID_SDK_ROOT is found : /home/osboxes/Android/Sdk

->Check environment variable ANT_ROOT
  ->Search for environment variable ANT_ROOT...
    ->ANT_ROOT is found : /usr/share/ant/bin


Please execute command: "source /home/osboxes/.bashrc" to make added system variables take effect

But still could not execute gen-libs properly cocos gen-libs -p android --ap android-22 --android-studio --app-abi x86 armeabi armeabi-v7a

Invalid or unsupported command "update project -t android-22 -p /home/osboxes/cocos2d-x-3.14.1/tools/simulator/frameworks/runtime-src/proj.android"

Supported commands are:
android list target
android list avd
android list device
android create avd
android move avd
android delete avd
android list sdk
android update sdk
Error running command, return code: 2.
Error running command, return code: 14.

I guess some of my setup have wrong version or something.

Please help me correct the configuration to spare me/and other newbies the compile fatigue.

Thanks.

Do you have android-22 installed?

Use android cl tool to add it. If you are using Studio use ask manager to add it there.

1 Like

It means u have installed latest Android SDK, cocos 3.14 trying to call android command in console, but it is not supported anymore in new Android SDK.

There is 1 solutions:

  1. Downgrade Android SDK (I think it is bad option)

  2. Upgrade cocos2d-x version to 3.15 - it using different android command to compile, so it should work - I think u even can just replace tools folder in cocos2d-x installation to use this

xmm :smiley: or maybe I wrongly interpereted your error and it should work…

1 Like

Of course I have android-22 downloaded. It’s about something else.

With cocos2d-x-3.15.1 this is the error

Building mode: debug
Using Eclipse project : /home/osboxes/cocos2d-x-3.15.1/tools/simulator/frameworks/runtime-src/proj.android
Ant (Eclipse project) is not supported from Android SDK Tools 25.3.0.
Error running command, return code: 101.

I used wayback machine to download android sdk tools 25.2.3 and rerun the gen-libs command.

It’s compiling now. I hope it will succeed.

I’ll report back when it’s done.

It’s compiled successfully. Thanks everyone. I’ll try to upload this virtual image somewhere and share it. (quite large though)

btw, why u using ant if trying to do spliting abi:) I think it is supported only with gradle so ushould compile with --android-studio flag

I didn’t know ant couldn’t do that. :smiley:

I’ll add the flag.

Thanks.