Cocos 3.6 to compile android in eclipse

How can i compile a cocos game android in eclipse (cocos2d-x 3.6)?

I copied my old build_native.py 3.4 into my 3.6 game android folder, but when i open eclipse and click on build project nothing happens…

I need to compile in eclipse because i am using facebook-sdk 4.0 directly, and for facebook sdk works, java compiler must be set to 1.7 or more. Using “cocos compile -p android” cocos is using java 1.5.

Anyway to use cocos 3.6 with eclipse?

I wonder if updating your system vars would help. I notice that after running setup.py my .bash_profile has the following variable definition that’s specific to the 3.5 install:

Add environment variable COCOS_CONSOLE_ROOT for cocos2d-x 3.5

export COCOS_CONSOLE_ROOT=/Applications/DevelopmentTools/cocos2d-x-3.5/tools/cocos2d-console/bin
export PATH=$COCOS_CONSOLE_ROOT:$PATH

Cocos 3.6 is giving me a painful/hard time to setting up. :rage2:

Cocos 3.5/3.6 has a broken build_native.py, so you need to use 3.4or -.
It looks liket Cocos 3.6 disables CDT Builder by default, so you cant run build_native.py (unless you you enable it)

If i stay on 3.4/3.5 i cant use WP8.1 back button (copying modified files from 3.6 wp8.1 universal over 3.4/3.5 project i dont think is a good ideia and code maybe be broken early or late). Lets do it in a clean way:

if i try to upgrade my game 3.4 to 3.6 build_native works only by enabling CDT builder, but .cproject get broken (giving me “An internal error occurred during: “Android Library Update”. java.lang.NullPointerException” window on eclipse, not project error, but the game cant be compiled anyway)

using cocos console, unfortunately will not work for me because my eclipse contains 3 projects:
libcocos2d-x
facebook (SDK 4.0, requires setting up java compiler compliance to 1.7)
MyGame (linking with libcocos2d-x and facebook)

When i run cocos console on 3.6: “cocos compile -p android”, facebook sdk is not compiled correctly (because it need javac 1.7, and cocos console runs it with 1.5 i dont know why), and i need to use my facebook implementation. (Using plugin-x is out of question: painful to setting up, workspace becomes a mess, use old facebook sdk 3.x, etc.).

What should i do? Hope some day cocos dev team read it :slight_smile:

Solved it using build_native.py on 3.6 (enabling CDT build on eclipse properties) and fixing manually the .cproject file (An internal error occurred during: “Android Library Update”. java.lang.NullPointerException)

how did you fixed your cproject file
?

Go to your \cocos2d-x\templates\cpp-template-default\proj.android\ .cproject file.

See there what changed (i don’t remember right now, but you need to remove some tags).

If you don’t want to change for every project just replace the two files .project and build_native.py of “Software/cocos2d-x-3.6/templates/cpp-template-default/proj.android” with same file of cocos2d-x version 3.3 or below.

After you create the project with cocos3.6 and direct run project from eclipse. So you don’t need to modify for every project.

If you already created the project just replace above two file under your projects proj.android folder.

If you get the An internal error occurred during: “Android Library Update”. java.lang.NullPointerException go through the below post
C/c++ indexer has encountered a problem eclipse .cproject file cocos2d-x version 3.3.

If any one need above two files please let me know I will give you.

Hope all gets working.

Thanks
Anjan

1 Like

I have the same problem, please tell me how to fix it. How to change javac compiler in ant.

I also have a big problem in regards on compiling in eclipse.
The version of my cocos2d is 3.9. I hope someone can help me with this problem thank you.
btw i’m a newbee here and i don’t know exactly what to do. Hoping for your response :smile:

I just had this problem, eclipse not calling the build_native.py file. I created a new project, copied the .project file and .externalToolBuilder dir into my current project. Go to properties in eclipse, Builders, and turn on CDT Builder.