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.
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.
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
Related
I have been working with Android SDK for a while & just came across an requirement to use the NDK
So, I downloaded the Android NDK for Windows. Jumping on the first example, when I am trying to build the library using the process defined in the NDK example
http://developer.android.com/sdk/ndk/overview.html
Specifically the command /ndk-build from the command line
I am getting the error
ndk-build is not recognized as an internal or external command, operable program or batch file
I have added the path for ndk-build in the PATH variable and even tried calling the command going to the folder, still the same error
Does anybody have a clue?
Guess that should have been an answer instead of a comment.
You must use Cygwin as your shell in order to run ndk-build.
See http://www.cygwin.com/
Once you have Cygwin installed you can have Eclipse automatically build your project for you by:
Right click on your project, pick properties.
Select "builders" from the left-hand list.
Click "New..." on the right side.
Select "Program" as the configuration type. I name mine "Native Builder"
Location - c:\cygwin\bin\bash.exe
Working Directory - c:\cygwin\bin
Arguments -
(for NDK r3):
--login -c "cd /cygdrive/c/Android_NDK && make APP=myapp"
(for NDK r4):
--login -c "cd /cygdrive/c/ && /cygdrive/c/Android_NDK/ndk-build"
Make sure you have the two hyphens before login and the quotes after the hyphen-c
Now go to the refresh tab
Check "Refresh resources upon completion"
Select "Specific resources"
Click on the "Specify resources" button and select your project's
lib directory.
Check "Recursively include sub-folders"
Now go to the build options tab
Check "Allocate Console"
Check "Launch in background"
Check "Run the builder After a Clean"
Check "Run the builder During manual builds"
Check "Run the builder During auto builds"
Check "Specify working set of relevant resources"
Click on "Specify Resources"
Select your project's JNI directory and all files within.
Now click OK on the bottom.
Now you can edit and save in your c files and it will compile and create the .so file on the fly.
Maybe, your development IDE hides system PATH and uses it's own PATH. I had same problem with MOTODEV Eclipse for Android 3.1. Detailed solution is here: How to solve problem with Motodev Eclipse for Android 3.1: wrong PATH It is for MOTODEV IDE, but Eclipse may have same thing.
i have problem when add openCV native C, to my project. first it just say
"Program "g++" not found in PATH"
"Program "gcc" not found in PATH"
but when I right click on my project --> Android Tools --> Add Native, I got more error, this is the error:
and this is what the console say:
I have no idea what should I do? someone can help me?
And This the program that I use:
- OS Windows 7
- Eclipse Juno
- OpenCV 2.4.5
If your IDE is eclipse,you must reset to the default settings. You can do it as following:
1- open Eclipse->Windows->Preferences->C/C++->Build->Settings
2- You will find, under the 'Discovery' tab, two options: [reset] or [restore defaults] the 'CDT GCC Build in Complier Settings [Shared]' or all settings.
I am trying to run an OpenCV4Android in my eclipse. I am working on Linux(CentOS 6).
I have done everything mentioned in this link but I am still getting build errors. I have also set the NDK path in preferences hat is not mentioned in the tutorial and tried a lot more things. When I try to build the library project the console gives:
"Cannot run program "/ndk-build": Unknown reason
Error: Program "/ndk-build" is not found in PATH"
All the projects also have build errors and the src and gen folders in openCV4 Library is not created and the build path shows:
"Unable to get system library for the project"
When i try to change the project properties I get an error saying the page contains invalid values and I cannot change the android api version. Plz help. Have been trying to set this up since 3 days now.
Thank you.
First Clean and Build you library Project alone and then try cleaning all your projects. In order to solve the "Cannot run program "/ndk-build": Unknown reason Error: Program "/ndk-build" is not found in PATH" error, Try the following steps:
Head to the project's properties. If you're using Windows, the shortcut is Alt + Enter; or simply right-click the project name to find its properties.
Go to the C/C++ Build section; under Builder Settings tab in Build command: text box you're likely to find something similar to that below, if it's empty then type in the similar text - namely: ${NDKROOT}/ndk-build.cmd where NDKROOT, as its name implies, refers to the path where your NDK root folder exists.
Now you must inform eclipse what NDKROOT equates to; as in, where is the NDK root path. You can do this by heading to (in your project's properties) C/C++ Build > Environment > press Add…
Now add your environment variable named NDKROOT (the Name) with the relevant path (Value). Note that you're to repeat this per NDK project. You would get a window similar to that below.
Press OK to the New variable input window and then OK again to the properties window.
Hopefully this will help!
currently i have difficulties trying to import the lynda.com android app development with java essential training exercise files into eclipse. I keep getting some java errors like this.Can someone help me out with this problem?
Currently im using
Android SDK r12
ADT 12 plugin for eclipse
JDK 7x64
JRE 7x64
LEclipse IDE for Java Developers 3.7 indigo
here's the error:
The project was not built since its build path is incomplete. Cannot
find the class file for java.lang.Object. Fix the build path, then try
building this project.
The type java.lang.Object cannot be resolved. It is indirectly
referenced from required .class files
(original screenshot below)
A little late on this, however after struggling with the issue myself I found a solution to the problem.
Right Click on the project --> Build Path --> Configure Build Path...
In the 'Source' tab, Select the project eg. 'myProject/src' --> Click OK.
Right Click on the project --> Android Tools --> Fix Project Properties
That should do it!
Have you tried changing your compiler to Java 5 instead of Java 7?
Also make sure that in the project settings that you're using Java 5.
Ryan,
I had the same problem and it was corrected by going to the project preferences(right click project -->preferences). Then go to "java build path" and click on the libraries tab. Look for your JRE lib in the list. In my case the system was unable to find it, but the entry was still there. Delete this and add a new one by clicking "add library" and select JRE System library. Then select the default system lib. Close out of the preferences window and then Right click on your project and go to android tools-->Fix project Properties. Clean your project and try building again.
This works
Project > Properties > Android > change the Build Target
I have been working with Android SDK for a while & just came across an requirement to use the NDK
So, I downloaded the Android NDK for Windows. Jumping on the first example, when I am trying to build the library using the process defined in the NDK example
http://developer.android.com/sdk/ndk/overview.html
Specifically the command /ndk-build from the command line
I am getting the error
ndk-build is not recognized as an internal or external command, operable program or batch file
I have added the path for ndk-build in the PATH variable and even tried calling the command going to the folder, still the same error
Does anybody have a clue?
Guess that should have been an answer instead of a comment.
You must use Cygwin as your shell in order to run ndk-build.
See http://www.cygwin.com/
Once you have Cygwin installed you can have Eclipse automatically build your project for you by:
Right click on your project, pick properties.
Select "builders" from the left-hand list.
Click "New..." on the right side.
Select "Program" as the configuration type. I name mine "Native Builder"
Location - c:\cygwin\bin\bash.exe
Working Directory - c:\cygwin\bin
Arguments -
(for NDK r3):
--login -c "cd /cygdrive/c/Android_NDK && make APP=myapp"
(for NDK r4):
--login -c "cd /cygdrive/c/ && /cygdrive/c/Android_NDK/ndk-build"
Make sure you have the two hyphens before login and the quotes after the hyphen-c
Now go to the refresh tab
Check "Refresh resources upon completion"
Select "Specific resources"
Click on the "Specify resources" button and select your project's
lib directory.
Check "Recursively include sub-folders"
Now go to the build options tab
Check "Allocate Console"
Check "Launch in background"
Check "Run the builder After a Clean"
Check "Run the builder During manual builds"
Check "Run the builder During auto builds"
Check "Specify working set of relevant resources"
Click on "Specify Resources"
Select your project's JNI directory and all files within.
Now click OK on the bottom.
Now you can edit and save in your c files and it will compile and create the .so file on the fly.
Maybe, your development IDE hides system PATH and uses it's own PATH. I had same problem with MOTODEV Eclipse for Android 3.1. Detailed solution is here: How to solve problem with Motodev Eclipse for Android 3.1: wrong PATH It is for MOTODEV IDE, but Eclipse may have same thing.