Cocos compile -p android DEPRECATED?

I’m porting my iOS app to Android and am using the Android Studio project that Cocos created for me.

I just updated Android Studio and now when I attempt to compile using:

cocos compile -p android --android-studio --app-abi armeabi --ap android-21

I get the following response:

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.

I’m very new to Android Studio and gradle. It looks like cocos compile command is trying to use an android command that is now gone.

How do I edit my Android Studio files do the same job the cocos compile command did? I see the Android.mk and Application.mk files are already part of the project, but Android Studio doesn’t use them when I tell it to build.

Any help would be appreciated!

Robert

This is being worked in. It is a bug. There is an open issue for it.

I have the same problem.
Because I am using Windows, I guess only about Mac.
But probably goes well.

Please download the old SDK file.
tools_r25.2.3-windows.zip
tools_r25.2.3-macosx.zip
From
https://developer.android.com/studio/index.html#downloads

Extract tools/android.bat or tools/android from this zip file,
Overwrite the current SDK folder and copy it.
In my case, “cocos compile” and “cocos run” is now successful with this work.

3 Likes

Is there a way for me to get around the bug so I can keep working?

Do you have a link for where the issue is being discussed?

Thanks for the help!

Robert

@WinshareGames sure: https://github.com/cocos2d/cocos2d-x/issues/17424

@bluewind00 we have engineers working on this issue. Hang tight. @zhangbin is working on this and has mentioned rolling back SDK versions helps.

@slackmoehrle I see. Thanks your help.

Hi everyone,

I managed to compile my Cocos2DX-android project in Android Studio after I stumbled with this problem. I used to do cocos compile too. I wrote a detailed document in PDF format on how I did it. Here is the download link.

https://goo.gl/IlUvSp

Let me know if it helped.

Thanks for checking it out, and thanks to the Cocos2d-X team and community!

2 Likes

Thanks. I added a link to your document in the GitHub issue for this. Perhaps it will help.

After I updated everything in my Android Studio, I had the same problem and your solution solved my problem.

Thank you very much

I’m getting the same issue today:

c:\dev\firebase\cocos2dx-cpp-sample\sample_project>cocos compile -p android --ap android-25 --android-studio --
app-abi armeabi-v7a
Building mode: debug
Using Android Studio project : c:\dev\firebase\cocos2dx-cpp-sample\sample_project\proj.android-studio
running: '"C:\AndroidSdk\tools\android" update project -t android-25 -p c:\dev\firebase\cocos2dx-cpp-
sample\sample_project\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-25 -p c:\dev\firebase\cocos2dx-cpp-
sample\sample_project\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.

Is the solution still to download old stuff??

Here Cocos compile -p android DEPRECATED?

Anyone come up with different solution to this? SDKBOX Appodeal seems to require the newest tools to compile for android-studio but the new tools don’t work with Cocos2dx… Not sure where to go from here, except switching ad services.

Would firebase work for ads? I have just managed to get the firebase sdk working for the first time under android. Admittedly all I can do so far is authentication but it might be a way to avoid sdkbox?

This problem is still not fixed . Any solution to make this work?

why anyone need android compile - use gradle it’s cool

No thanks.
XCode for dev (Eclipse only if i have some android spec crash)
But for android build? Simple cocos console.

Some commands are removed by Android SDK. You should copy tools folder from older Android SDK if you need to continue using Ant.