Cocos2Dx does not use Gradle build system

Hello,

I am new here and this is my first post. I have a question concerning cocos2dx and Android Studio.

I followed this guide to get Cocos2Dx into Android Studio: https://www.youtube.com/watch?v=B9ObAzm6rnQ. The project has no errors, I am able to build, compile and run the project, however, it does not use the Gradle build system. There are no gradle files at all and I cannot figure out how to get them added. All things considering, everything seems to be working so my question is two fold. How can I get the gradle files into the project? And what is the worse that can happen if I continue the project without gradle files?

I have tried deleting all .iml files and .idea folder and then re-importing. I received the wizard that asked to make the project Gradle or Maven. I selected Gradle as normal, but after the setup process the project structure remained the same.

Additionally, each time I run the project the run wizard comes up asking if I would like to convert to Gradle and then I select yes, nothing happens. I receive a dialog that says “my project is not configured correct, would you like to run anyway”. I select yes and the project runs as normal.

Lastly, I tried creating my project and importing the cocos2dx as a referenced library in Eclipse. I then imported as a non-existing Android Studio project. I followed the wizard and again the results are the same.

Currently, this is how the project structure looks.

And this is the error I am receiving

I poised this same question on stackoverflow and they were not able to help me. I am hoping that the actual cocos2dx community can provide some answers.

Thank you!

What you should do is use a build.gradle file, and import this file using Android Studio “Import project” feature.

I would advise checking the build.gradle is correct by compiling your project in command line first.

Please use that pull request (closed, unmerged since cocos2d-x won’t support it for now) as a guide: https://github.com/chukong/programmers-guide/pull/47

Wait! Too fast. From where do I get the build.gradle file? Should I create a new project that has one, and then copy it into the project I intend to use? I created the project and built with cocos2d through command line. Even when adding build.gradle to my project and rebuilding Android Studio does not recognize the project as gradle structure.

Cocos2d-x doesn’t support Gradle, which means you need to create your build.gradle file yourself, or use a sample to get started, as the one in the link I provided.

Then, try to re-import it in Android Studio if Android Studio doesn’t detect it automatically.

I understand, thank you for your help!