[SOLVED].cocos-project.json file not found

Hello Devs,

I have an issue in building android project in mac.
FYI, my project works fine in IOS, but when I try to build it using android then I am facing some issues.

I have setup all the environment variables.
when I try to run -

build_native.py through terminal it says - " unable to find .cocos-project.json "
As in mac all the files preceding with . are hidden, so may be build procedure is not able to find it.

I don’t know how such a big thing is left unsolved.
I saw some work around but I am not so sure of it.

Could anyone suggest me any proper way of handling these.

Also, FYI, the cocos compile command is giving some errors don’t know why… !!
I would be glad if someone helps. :smile:

cocos2d-x 3.6
ndk r 10 c
sdk version 20

Also -
Is it good to go now with android studio… ?
how is the current stage of support in android studio for cocos2d-x ?

Thanks in advance. :smile:

@stevetranby could you help. .??

I also got that error first time but after trying couple of times it went away.
Also i am using cocos console, so i am using this line cocos deploy -p android
with cocos2d-x 3.6, ndk r10 d and sdk-19

It will support once stable version of android studio 1.3 comes as it will support NDK.
So may be in 3.8

are you developing using windows or mac. ??

because in mac, it is not able to find that file
reason is - it starts with a dot, so that file is hidden.

Well i am using both but i was talking about mac only.

Yes, you are right.
But i think it was working after i tried 2-3 times.
Also i tried copying cocos-project.json file without initial dot from win system at that time, which helped me or not that i dont know.
But after that with every new project i dont have any problem :smile:

I will try with the file without the dot
I hope that will pretty much solve the issue.

And also for compiling, I still believe in using the build_native.py although.
I will start with cocos console command now.

Thanks for your help @smitpatel88 :smile:

Yup, I created another file without the dot and placed it in the root folder of the project.
Then the build for android worked.

Thanks @smitpatel88 for your help. :smile:

Glad you figured it out.

I just created a new -l js project. I was able to cocos compile -p android with the dotfile .cocos-project.json Maybe your permissions are an issue?

cocos new creates this file and it is used to store cocos2d-x version and language information.

Something like:

{
    "engine_type": "prebuilt",
    "engine_version": "cocos2d-x-3.6",
    "project_type": "cpp"
}

if you don’t have one, you can just make one

touch .cocos-project.json
nano .cocos-project.json

paste in a minimum of

{
    "project_type": "cpp"
}

yes @stevetranby

may be permission issue only.
But I kept both the files - with and without dot.

I tried deleting the dot file but it then gave some kind of error
but keeping both works fine. :smile:

Glad that worked.
Did you try removing that file without the dot after that?
Also try creating one demo project and check whether its working without adding any extra file.
It should work now :smile:
INDIAN Mac :sunglasses: