why “cocos compile -p android” gives “The android command is no longer available.” error

泄露秘密 提交于 2019-12-22 04:37:16

问题


I am working on a cocos2d-x project. i always compile android project using cocos command cocos compile -p android --android-studio -m debug. But now this command returning an error. The android command is no longer available.

For manual SDK and AVD management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
Error running command, return code: 1.
Error running command, return code: 14.

i can't figure out the problem. why this is giving error? what did i changed that caused this issue? I am working on Mac OS sierra, Cocos2d-x 3.14.1, Android Studio.


回答1:


After some digging about what changes I made in my development environment, only thing I could think of is Android SDK tools. I updated it one day before I run this command. Also I found an open issue for that in Github : https://github.com/cocos2d/cocos2d-x/issues/17424 This is a known issue which is being handled and under progress. So temporary work around is to download the previous version of android SDK tools and replace it with updated one. SDK tools that was working before : 25.2.3 : https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip (form mac), https://dl.google.com/android/repository/tools_r25.2.3-windows.zip (for windows).




回答2:


Now not need to downgrade to previous Android SDK tools version. You can now use Android SDK Tools 25.3.x.

Here is the pull request for the same.
https://github.com/cocos2d/cocos2d-console/pull/410

I deleted all content inside this cocos2d-x-3.14.1\tools\cocos2d-console folder then downloaded this module cocos2d-console and copied all content to cocos2d-x-3.14.1\tools\cocos2d-console
folder.

then on console I run command

cocos compile -p android --android-studio --ap android-24

Build succeed.




回答3:


I also searched for a solution for this but it seems like downgrading to previous android SDK version is what you should do for now.



来源:https://stackoverflow.com/questions/42552341/why-cocos-compile-p-android-gives-the-android-command-is-no-longer-available

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!