Error in cocos command

I have installed Cocos2d-x for android in windows. And I have run the setup.py file successfully.
When I tried to check if I did it all ok, I restarted my PC as I was asked to and open the cmd,
I tried the command, cocos just to check if its ok and I got this error:

C:\Users\Gilad>cocos
Traceback (most recent call last):
  File "C:\Users\Gilad\AppData\Local\Programs\cocos2d-x-3.12\tools\cocos2d-console\bin\/cocos.py", line 22, in <module>
    import cocos_project
  File "C:\Users\Gilad\AppData\Local\Programs\cocos2d-x-3.12\tools\cocos2d-console\bin\cocos_project.py", line 4, in <module>
    import cocos
  File "C:\Users\Gilad\AppData\Local\Programs\cocos2d-x-3.12\tools\cocos2d-console\bin\cocos.py", line 935, in <module>
    locale.setlocale(locale.LC_ALL, '')  # use user's preferred locale
  File "C:\Users\Gilad\AppData\Local\Programs\Python\Python27\lib\locale.py", line 581, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

I know that this solution should solve it: Cocos2d-x v3.9 released!
But it doesn’t work for windows.
Anyone know how can I fix it in windows?

Is this your first install? Can you upgrade to 3.17.1?

Yes it is the first time I’m installing cocos2d-x.
I can upgrade, but I read that if I want to develop my game in visual studio I have to use v3.12. So should I upgrade?

Yes upgrade. What you read is old.
What locale is your system?

How are you getting Cocos? Zip from our website or cloning our GitHub repo?

I’m getting it as zip from the website,
I will try to read about the locale settings and change them. I think I can do that from the control panel.

When I’m running the setup.py for the v3.17 I’m getting this error:
->Error: "C:\Users\Gilad\AppData\Local\Programs\android\sdk" is not a valid path of ANDROID_SDK_ROOT. Ignoring it.

Although when I’m running ‘cocos’ in the cmd it works fine. Isn’t it strange?

Sorry for bothering you but I’m very new to this :smile:

Where is your Android sdk located?

cocos command relies on python. Unless a cocos compile is working for you?

Does running cocos new work?

My SDK is locted in “C:\Users\Gilad\AppData\Local\Programs\android\sdk”
And I will check for the rest in a few hours. Thank you for helping!

on my Linux and Macs, I have these defined:

export NDK_ROOT="/usr/local/share/android-ndk"
export ANDROID_NDK_HOME="/usr/local/share/android-ndk"
export ANDROID_SDK_ROOT="/Users/dubb/Library/Android/sdk"

Perhaps it will help define for windows. @mars3142 probably uses windows and he knows his Android backwards and forwards. Perhaps he can clarify paths.

I’m sorry. My working device is a MacBook Pro. I do have Windows in Parallels installed, but not for Android. And because the error is from setup.py, if I understand the report from @giladk correct, it wouldn’t be an Android issue per se.

I checked the setup.py and there seems to be two checks. The first one checks for ndk-build.cmd and the second one is looking for android.bat. Your error is because of the missing android.bat file. Please check you do have a android.bat in the ANDROID_SDK_ROOT/tools folder.

But because of the error, I’ll bet the file is missing. So my advice: Reinstall the Android SDK

@slackmoehrle Any other ideas?

I can try a virtual machine and see how our instructions are working. Perhaps we need more documentation about Android on Windows.

guys I can’t exactly setup my cocos2d-x in setup.py. it says that the file I have isn’t the android sdk even after I downloaded android sdk and the studio. what file exactly is the android sdk?

We need a lot more info than that :slight_smile: @Jackob_Abiy

i just want to know that I am installing the right sdk from the android developer website. I down loaded it from the part where it says"sdk command line tools ". thanks

How would we know what you are doing?

Please use our docs: https://docs.cocos2d-x.org/cocos2d-x/en/installation/Android-Studio.html