为什么“cocos编译-p android”给出“android命令不再可用”。”的错误

时间:2021-08-22 00:11:24

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.

我正在做一个cocos2d-x项目。我一直使用cocos命令编写android项目cocos编译-p android——android-studio -m debug。但是现在这个命令返回一个错误。android命令不再可用。

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.

我想不出这个问题。为什么会出错?造成这个问题的原因是什么?我正在开发Mac OS sierra, Cocos2d-x 3.14.1, Android Studio。

3 个解决方案

#1


19  

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).

在挖掘了我在开发环境中所做的改变之后,我只想到了Android SDK工具。我在运行这个命令的前一天更新了它。我还在Github上发现了一个未解决的问题:https://github.com/cocos2d/cocos2d-x/issues/17424这是一个已知的问题,正在处理和处理中。所以暂时的工作是下载以前版本的android SDK工具,用更新后的工具替换它。SDK工具: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 (windows)。

#2


1  

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

现在不需要降级到以前的Android SDK版本。您现在可以使用Android SDK工具25.3.x。

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

这是相同的拉请求。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.

我删除了这个cocos2d-x-3.14.1\tools\cocos2d-console文件夹中的所有内容,然后下载了这个模块cocos2d-console,并将所有内容复制到cocos2d-x-3.14.1\tools\cocos2d-console文件夹。

then on console I run command

然后在控制台我运行命令

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

Build succeed.

构建成功。

#3


0  

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.

我也为此寻找了一个解决方案,但似乎现在应该做的是降级到以前的android SDK版本。

#1


19  

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).

在挖掘了我在开发环境中所做的改变之后,我只想到了Android SDK工具。我在运行这个命令的前一天更新了它。我还在Github上发现了一个未解决的问题:https://github.com/cocos2d/cocos2d-x/issues/17424这是一个已知的问题,正在处理和处理中。所以暂时的工作是下载以前版本的android SDK工具,用更新后的工具替换它。SDK工具: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 (windows)。

#2


1  

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

现在不需要降级到以前的Android SDK版本。您现在可以使用Android SDK工具25.3.x。

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

这是相同的拉请求。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.

我删除了这个cocos2d-x-3.14.1\tools\cocos2d-console文件夹中的所有内容,然后下载了这个模块cocos2d-console,并将所有内容复制到cocos2d-x-3.14.1\tools\cocos2d-console文件夹。

then on console I run command

然后在控制台我运行命令

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

Build succeed.

构建成功。

#3


0  

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.

我也为此寻找了一个解决方案,但似乎现在应该做的是降级到以前的android SDK版本。