Hello everyone,
I spent the past three days trying to get a Cocos2d-x android project to build on my new Windows 10 machine for Android Studio. I had to fix the following issues in order to build and run my project:
JDK Version:
In my experience, the build requirements were spot on except for the JDK version. I tried using the latest JDK version (v12.0.1) when attempting to compile my Cocos2d-x project and it produced a build error. The same happened for JDK v1.6. In the end, I installed the JDK v1.8.0, created a JAVA_HOME Environment Variable, then attempted to compile my Cocos2d-x project and it built successfully!
Gradle Plugin Update:
When I opened my project for the first time in Android Studio the following dialog box appeared.
I selected Update and proceeded to build my project.
Merge Assets Error:
After a successful build I received the following warning:
In order to fix it I had to open my App’s proj.android file and update the variant.mergeAssets.doLast line as shown here:
Update that line to the following to get rid of the warning:
Project Properties:
I had to open the gradle.properties file and remove the default setting for PROP_APP_ABI and set it to x86
Build Variants:
The last thing I did was to update the Build Variant for my project CrabApple to debug-x86
Final Thoughts:
It was a pain in the butt to get up and running with Cocos2d-x which sucked since this is my first time using a framework for building 2d games. I’m sure this process will continue to get better and I hope that my post will help others who run into the same roadblocks I did.