Hi, I'm new to android developing with NDK , I'm using ndk-r9d and cocos2d-x 2.2.3.
When I create a project with cocos and import to Eclipse , in the conversion phase the name of the project not shown in the candidate for conversion section of convert to a C`C++` project.
Can anyone help me???
It might well be that the project is already with C/C++ nature,
you said you have the C++ menus,
do you also have for example this menu in the image?
If so, you're good to go and start compiling C++ code.
try using the eclipse c/c++ development. I was also facing same issue when using eclipse for java/jee development. I simply added C/C++ support by downloading packages to Java/Jee eclipse. After installing proper eclipse for c/C++ development, I was able to see "convert to c/C++...." option.
Related
I want to use OpenCV library in both my Java codes and JNI C++ codes in Android Studio.
How can I import OpenCV library and set up the NDK environment (JNI) in the same android project in Android Studio?
I could successfully do either one, but could not do both in a project even though I have tried many times.
I followed these two tutorials to set up the environment.
1. OpenCV for android
2.JNI/NDK
Does anyone have any idea why my setup was failed?
Or can anyone provide me a guide to set up the environment?
I am writing an Android app which will use OpenCV so I need to use C++ for parts of my app. I am following the tutorials on OpenCV which explain how to include native code in your app. I want to build the native parts using CDT which I have downloaded and installed.
I am following these steps http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_dev_intro.html#cdt-builder
but am stuck at the part that tells me to add C/C++ nature to my project.
I cannot find this option in Eclipse anywhere. It doesn't appear when I right click my project and I have tried adding it from Window >Perspective >customize this perspective >Shortcuts >C/C++ and it isn't there either.
Is there some way that my project could already have C/C++ nature?
I am using Eclipse Juno with ADT.
I'm very new to Android development so I apologise if this is a silly question. Thanks in advance for any help/guidance.
If you have an Android app project, you have an Android Tools item in project context menu (i.e. click right mouse on the project name in the left pane).
There you will find Add Native Support. It will ask you an irrelevant question about the name of the shared library, and it will add an empty C++ file to your jni folder. Your project will now have C/C++ nature in addition to its Android/Java nature.
i am learning android ndk. writing c/c++ code in eclipse without suggestions is it hard. so can any one help me out with the procedure to get the suggestions.
Thank you,
You could use eclipse ide that's meant for c/c++ programming language. And edit code and compile code in this IDE. Since you only need to know the path to ndk-build, it does not matter which IDE you use to edit c/c++ code. In your Android project Eclipse IDE, all you care is the presence of the .a or .so or .la libraries at appropriate folders anyways.
HTH.
I'm having a hell of a time importing OpenCV into my Android project. I've already tried this tutorial:
http://opencv.itseez.com/doc/tutorials/introduction/android_binary_package/android_binary_package.html
and it did not work because Eclipse would not recognize the existing projects in the directory. So after much searching I came across this trunk:
https://code.ros.org/svn/opencv/trunk/opencv/
and was able to import it into my workspace in Eclipse. Eclipse now recognizes the sample projects, but now the problem is that there are no OpenCV library files. So all the calls to import different classes result in errors. Shouldn't there be a opencv.jar somewhere? I've seen various posts that mention having to build the library but unfortunately I don't have the slightest clue how to do that. I need something with step by step instructions. I'm running Windows 7 64-bit.
Thanks!
You should download the latest OpenCV 4 Android here:
http://opencv.org/downloads.html
And read these tutorials to get you started (in this order roughly):
Introduction into Android Development
OpenCV4Android SDK
Android Development with OpenCV
OpenCV4Android Reference
If you want to use OPEN CV in your android apps, for example if you need to read some strings from an image in your android and you are new in using OPEN CV. Then download the pre-built OpenCV library for Android from here:
http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.3/
After downloading, import OpenCV-2.3.1 into Eclipse using File-->Import...-->General-->Existing Project Into Workspace.
In your project's properties, Under Android, add the OpenCV2.3.1 library (press Add.. on the right and select OpenCV2.3.1).
Good luck!
You might want to take a look at this project: https://github.com/billmccord/OpenCV-Android
I was able to run opencv applications on my android phone with the help of this port.
installed the Win-superpack?
I recommend getting the latest .tar, extract and use it. Worked for me.
I posted about this on a duplicate question. Make sure you have the android NDK installed! Or, consider using JavaCV instead. It is much easier to install.
I am building C libraries that will be used by an android app(through either JNI or the NDK, I've never used the NDK though) and I am wondering what IDE/development environment is best to use? I've basically only used Visual Studio for native development and I'm not sure how to adapt to building .so libraries for use on android.
Thanks
EDIT: Update -- I want to avoid makefiles if possible (never used them) and rather use a complete IDE such as the case with visual stuido to compile
Generally, cygwin (i.e. command line) is used for building Android native code. But you can also try to use Eclipse for this purpose. It doesn't help very much but it highlights syntax and you don't have to switch to other apps to write code and build your app. You can read more about using Eclipse for C/C++ Android development here.
I would strongly recommend that you use the NDK's compiler.
Normally this is done by writing an Android.mk in accordance with the instructions for the NDK. It is not complicated. The easiest thing to do is to grab the hello-jni sample app and just make the necessary changes, for example substituting your source files into its android.mk.
You can stay in visual studio if you like that as an editing environment, simply using the ability to bind an external command to a keystroke to launch the ndk build script. Ages ago I had figured out how to reformat GCC error messages with sed into something that VS could parse to make them click-able, though I soon moved development of that project under linux.
I think a lot of people use Eclipse as their IDE for Android development. I use it and its pretty good. You shouldn't have any problems if you're used to VS.
The Android SDK comes with a plugin, the Android Development Tools (ADT), to develop applications for Android inside the Eclipse IDE, which is same kind of beast as Visual Studio. And within that IDE, it is possible to use JavaCPP (disclaimer: I am the author) to have it compile all the native C/C++ stuff we need through the Android NDK, but without needing Makefiles and such. More details here:
http://code.google.com/p/javacpp/#Instructions_for_Android