Search code examples
javaantpathandroid-ndkcocos2d-x

Java build path error in cocos2dx 3.6


I migrated from cocos2dx 3.1.1 to 3.6.
When I make a new project and build in Eclipse, I get the following error:

could not open 'C:\Program Files (x86)\Java\jre7\lib\i386\jvm.cfg

I checked environment variables. Although all of my environ variables are on E:\, build_native keeps telling about C:\. Even though there isn't a Java folder in C:\Program Files (x86). I have only JDK1.8.0_45 on E:\.

My Eclipse runs well.
My other projects that using cocosdx3.1.1 are still working.

Cocos2dx uses ant, ndk, cygwin64, etc.

[name : value]

(User var)

ANDROID_SDK_ROOT : E:\Android\android-sdk

ANT_ROOT : E:\apache-ant-1.9.4\

CLASS_PATH : ;

COCOS_CONSOLE_ROOT : E:\cocosProj\cocos2d-x-3.6\tools\cocos2d-console\bin

COCOS_TEMPLATES_ROOT : E:\cocosProj\cocos2d-x-3.6\templates

JAVA_HOME : Neither E:\Java\jdk1.8.0_45\jre\bin` Or `E:\Java\jdk1.8.0_45\ working

NDK_MODULE_PATH : E:\cocos2d-x-3.6;E:\cocos2d-x-3.6\cocos\platform\android
NDK_ROOT : E:\android-ndk-r10d
Path : E:\cocosProj\cocos2d-x-3.6\templates;E:\cocosProj\cocos2d-x-3.6\tools\cocos2d-console\bin;E:\cygwin64\bin

( system var)

...(omit)....

%NDK_ROOT%;E:\Android\android-sdk;
E:\cocos2d-x-3.6\tools\cocos2d-console\bin;E:\cocos2d-x-3.6\templates;
E:\cocos2d-x-3.6;E:\android-ndk-r10d;
E:\apache-ant-1.9.4\bin;E:\Android\android-sdk\platform-tools;
E:\Android\android-sdk\tools;
E:\cygwin64\bin;E:\Java\jdk1.8.0_45\jre\bin;

My system is : Windows7, Eclipse version: Kepler Service Release 1

There is a more detailed error message. I run command line of Windows and run python build_native.py.
Error message link to imgur below:

https://i.sstatic.net/AH6wg.png


Solution

  • Resolved myself. I successfully have built the project.

    I test cocos2dx 3.6, 3.5, 3.4 . A all of them are failed. But find out how to make it!

    Below is my method.

    First, I change tools version to below things. And change environment variables to fit them.

    cocos2dx 3.4
    NDK r9d
    

    But I had got errors too. So,

    Second, I remove cocos2dx sdk 3.4 folder and re-unzipped. At this time, Environment variables have been already made. So I didn't run setup.py and download-deps.py. I think that when first cocos project build, cocos's references to environment variables is fixed. So If I change 'env var' after first build, it wouldn't refreshed automatically.

    Finally, My projects are working well now.

    I suggest whom have problem to build to delete and re-install coco2dx framework. If it don't work, Change cocos2dx version or ndk version. And delete and re-install coco2dx framework. It demand much time. But in some try, you will succeed.

    Sorry for my poor english. But I really want share test-case that works fine for me.