I bought a new computer and I installed Cocos Creator 1.4.2 with the latest Android Studio (2.3.1). When I try to build an APK of my game, the “build” finishes without error, but the “compile” fails. In the native.log file I see the following:
Building mode: release
Using Android Studio project : C:\Users\PZsol\Documents\Cocos14\AriesPegSolitaire\build\jsb-default\frameworks\runtime-src\proj.android-studio
running: ‘“c:\Users\PZsol\AppData\Local\Android\sdk\tools\android” update project -t android-19 -p C:\Users\PZsol\Documents\Cocos14\AriesPegSolitaire\build\jsb-default\frameworks\runtime-src\proj.android-studio\app’
The “android” command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools\bin\sdkmanager.bat
and tools\bin\avdmanager.bat
Invalid or unsupported command “update project -t android-19 -p C:\Users\PZsol\Documents\Cocos14\AriesPegSolitaire\build\jsb-default\frameworks\runtime-src\proj.android-studio\app”
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: 1.
Thanks for your reply, it helped. I replaced the android.bat with the old one, but now I get the following error message:
Error: Unable to access jarfile lib\archquery.jar
Invalid drive specification
ERROR: SWT folder ‘’ does not exist.
Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.
On my old computer there is no such environment variable, and it works… what’s wrong now?
That is true, but it stops compiling. Maybe there is some problem with the Android NDK path, because compared to my old installation Android Studio 2.3.1 stores the NDK on a different path.
But for building the APK I can still use my old computer, so it is not soooo urgent, I can wait for the “official” support in Cocos Creator.
Referring to all the fix by replacing tools solution, I don’t think this is a long term solution. Since Google have planned to deprecate it, using an older version tools as a workaround solution is basically assuming we wouldn’t update the tools at all in the future.
For manual SDK, AVD, and project management, please use Android Studio.
Seems like Google wants workflow to be managed using Android Studio. Perhaps the better solution is to document a Cocos Creator project compiled with android studio process.
First of all, NDK stands for Native Development Kit. Since the default app development language on Android is Java, the kits allows usage of native (C++) code.
We will face another issue while working with Cocos Creator project since they are not supporting the latest NDK version. The last official supported version I known was version r10e.
Android Studio manages the NDK, by default on Mac OS it is placed at “/Users/yourusername/Library/Android/sdk”. Note that there’s no way of downgrading the NDK. You will need to figure out a workaround if your version is not supported by the Cocos team.
PS: Perhaps replacing NDK with the desired version on the path that Android Studio referring to might work.
Meanwhite I created a build for the Android Studio (the Android Studio checkbox was checked). It was able to compile and create the APK that was successfully uploaded on my Android device(s), but the game crashes on start.
This method can be a workaround, I create a “build” with Cocos Creator, and “compile” with the Android Studio. But it does not work… any idea?
This PR updated the cocos2d-x-lite to support latest android-studio and ndk.
And one more feature is it will auto compile native code when build apk in android-studio.
This feature will be published in v1.5, or you can modify your project yourself according to this pr.