Kapil
Kapil

Reputation: 1810

coco2d-x: java.lang.IllegalArgumentException: Unable to find native library

I have started learning Coco2d-x and want to run the sample app on my android phone. I have imported sample project Hellocpp in my eclipse and fixed the library path. I am able to install it on my device but when i run it i get below error. I am following this tutorial: coco2d-x Please help me out.

enter image description here

Upvotes: 3

Views: 1911

Answers (1)

samdonly1
samdonly1

Reputation: 438

Are you sure you have the linked the source cocos library to your project in the java build path. and if so. please check your environment variables for COCOS2DX_ROOT,NDK_ROOT.

1: In Eclipse, right-click on your project and select the last option "properties". 2: In Project Properties window, select "Java Build Path" in the left pane. 3: Under Java Build Path, select tab "source". It should be selected by default. 4: Click on button "Link Source" 5: Browse it to following location-> COCOS2D-X_INSTALLATION_FOLDER/cocos2dx/platform/android/java/src. My path will be: E:\cocos2d-x-2.2\cocos2dx\platform\android\java\src 6: Give any folder name. For example, remove src and replace it with: Cocos2d-x-source. Click Finish. We are done now. Run your poject on an Andorid Device and it should show you the nead cocos2d-x logo. Please note that running this in an Android Virtual Machine may not always work.

  1. If there is an error after the project has been imported and build like:

Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml eclipse

You can change the Eclipse settings by following these steps, provided by a someone from Google (at this link) (but also, see my IMPORTANT note below):

IMPORTANT! What the Google guy didn't note is that you also need to use the "Move Up" button in the settings to move your new rule to the top because otherwise some other more generic rules overshadow it and it doesn't work.

In eclipse:

  • Window -> Preferences -> C/C++ -> Build -> Settings
  • Select CDT GNU C/C++ Error Parser
  • In the Error Parser options at the bottom, add a new entry with the following contents:

Severity: Warning Pattern: (.?):(\d+): Android NDK: WARNING:(.) File: $1 Line: $2 Description: $3

Upvotes: 2

Related Questions