cocos2d-x android set up error - java.lang.NullPointerException
Asked Answered
I

1

6

I'm trying to set up cocos2d-x for android and I followed a video tutorial

I passed the steps for terminal without any problem (setup.py command result is as expected).

My problem is after I set NDK_ROOT in C/C++ Build - environment section, I get some java.lang.NullPointerException exceptions.

For example when I restart eclipse I get the following error.

An internal error occurred during: "Android Library Update".
java.lang.NullPointerException

When I try to reopen C/C++ Build - environment section I get The currently displayed page contains invalid values. error and I can't edit the environment values.

I checked java build path, there is no JRE system library and when I try to add I get the same error

An error has occurred. See error log for more details.
java.lang.NullPointerException

How can I fix the problem? Thanks for your help.

I'm working on

  • Mac OS 10.9.4
  • android-ndk-r9d
  • apache-ant-1.9.4
  • cocos2d-x-3.2
  • adt-bundle-mac-x86_64-20140702
Igor answered 23/8, 2014 at 13:25 Comment(0)
M
17

I've been trying to fix this for a while, I'd suggest comparing the .cproject file in your project with the one in templates/cpp-template-default and removing extra section(s) in your file. I had to remove one section, I don't why it was added but it works now.

Update: It seems this section is added once you open eclipse with NDK_ROOT not defined, and after that, even if you define it, this section stays there in the configuration files and causes the same errors, you need to remove it to get your project to work.

The section looks like this, you can remove it safely after you close eclipse.

<cconfiguration id="0.1230402123.1377291156">
            <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1230402123.1377291156" moduleId="org.eclipse.cdt.core.settings" name="Debug">
                <externalSettings/>
                <extensions>
                    <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
                    <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
                    <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
                    <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
                    <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
                    <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
                </extensions>
            </storageModule>
            <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
        </cconfiguration>
Milly answered 17/9, 2014 at 14:4 Comment(2)
Thank you! This issue still plagues the cocos2d-x project, even at version 3.3-rc0.Reive
Indeed a life saver!Marcellmarcella

© 2022 - 2024 — McMap. All rights reserved.