I have a rather simple question. I built the OpenCV library with the help of MacPorts. All the files are in my opt directory as they should be. I'd like to use the libopencv_core.2.2.0.dylib in my Android project in Eclipse. There is a method cvnorm() in that library which I want to use. I'm writing a simple little Android app which will need to use some of the methods from OpenCV. I can't seem to add this library to the project, it says it's invalid file type. Would appreciate any help you could give. Thanks!
There is a special OpenCV trunk for Android. Try this tutorial.
Even it's written for Windows, it worked like a charm in my MacBook Air.
Related
after a couple of weeks I have been unable to get the android set of tools to a functioning level with c++ before and have been given the opportunity of using a project tango, and though that sounds awesome and wondrous and would open a world of opportunity for working with VR... I feel like I am stuck at step -4. My understanding is limited, so bear with me.
I stumbled upon the PCL built for running algorithms on point cloud data, it was open source and appeared like a wonderful solution, it is written in C++ and I have a mild understanding of both c++ and java.
I have tried using Eclipse and the NDK and actually managed to get a project 'deployed' to the tango, however upon attempting to edit any file in the project, java or c++, it breaks and will never deploy again.
Now I am trying to use Android Studio, and after following about 5 conflicting tutorials on 'how to get C++/ndk working in android studio' I have yet to get a working environment.
So here is my question, and we can start at step one, any help is appreciated. How does one get c++ and the PCL working on a google project tango, is there a better way for someone of my skill level? The end result is a mapped 3d space with the project tango, with exportable data sets of manageable size. I have seen it done in demos on youtube, but thus far, like i said, I am stuck on step -4.
we are working on converting all project to android studio based, for now, here is the walk around to get you started:
Open Android Studio, import the project from the repo you just cloned.
Take the motion-tracking-jni-example as the example, copy tango-gl-render, tango-service-sdk, and third-party into the motion-tracking-jni-example/app/src.
Run ndk-build in the motion-tracking-jni-example/app/src/main folder.
ndk will generate the libs folder, rename it to jniLibs.
Go to Android Studio, in build.gradle(Module:app) file, add line 'sourceSets.main.jni.srcDirs = []' to the defaultConfig section.
Just click the run button in Android Studio.
What we did here is basically disabled the Android Stdio's JNI compile and manually built it using ndk.
Start with unity3d, its easy to get a working demo with a week with Unity3D.
And support is very good, documentation is top notch.
Hope this will help.
Tango NDK Tutorial Will help but the basic layout is
Setup a new project
Create your Java activity
Create a JNI file to bridge Java to the C++
Create your C++ logic
Setup your Makefiles and Gradle (probably the most annoying part)
Hi im using Android Studio ver. 0.8.6 now i want to use andEngine, i know that i should download andengine.jar file and copy it to libs folder in my project, everything is all right, but i can find the andengine.jar GLES2 there are only files with 1st version, and the newest examples didn't work with it, can someone pls give me link to andengine.jar GLES2? or maybe im doing something wrong?
I'm taking examples from official site and there are a lot of errors one of them:
extends BaseExample
AndEngine GLES2 may be downloaded From Here
You can download AndEngine.jar file From Here
You can download other types of AndEngine.jar file From Here
Also here are some examples about AndEngine From Here
AndEngine GLES2 may be downloaded Alternatively From Here
https://github.com/nicolasgramlich/AndEngine/tree/GLES2-AnchorCenter Use this link to get the latest andengine also download the physics engine which is a separate jar.
or maybe im doing something wrong?
Yes. First of all, you should not be using JARs anymore. You should add AndEngine and any extension as an Android Library project (Eclipse terminology) or Module (Android studio terminology).
UPDATE: Since the Android Studio became the official IDE for Android, it is now recommended to use it. However AndEngine stopped being developed by its author and its populatity is on decline. Anyway see a related question to add the module/library project to your game.
As #sm4 pointed out it is recommended to simply clone the git repo. However, after cloning the repo you will experience errors in AIDE when compiling. See my question and answer to see why I think this happens and how to fix it.
I have been having tough time in finding a IDE or Editor which can help me easily modify the Android's C/C++ classes (mainly the classes under frameworks/base/core/jni)?
All the sites point to using Eclipse for development. But the dependencies were not resolved for C/C++ files. Java related dependencies are correctly resolved and the project is good enough to view the source files without any errors.
Right now, I just browse the C/C++ code in Eclipse CDT and make changes, compile using regular AOSP make commands and push it to my custom ROM. I am working on device drivers related work, so cannot use Emulator to test the changes :(
Two queries:
Is there a way, I can get content assist for Native C/C++ code for Android Source code ?
Is there any easy way to edit/build/run the native libraries quickly on Device ?
Any pointers will be highly appreciated.
You are on the right track. You build AOSP from terminal, but use IDE for browse/edit/debug sessions.
What worked for me is creating a big eclipse C/C++ project containing everything under frameworks/base. Use it for browsing/editing/debugging using all the helpers that eclipse provides.
Please check Debugging Android native applications to understand AOSP debugging.
I also have this problem! My solution is to re-set NDK path in "local.properties".
When i use default ndk path (ex: ndk.dir=C:\Users\%user\AppData\Local\Android\Sdk\ndk-bundle sdk.dir=C:\Users\%user\AppData\Local\Android\Sdk ) , I will have the same problem. So I download other NDK (from google official web-site) ,and set "ndk.dir", and I sloved.
You can try it~ maybe helpful for you.
ps. I use NDK version:14 , will happen this. I use v13 or v12 will solved.
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'd like to build some native libraries for android using the NDK (native development kit), but i'd like to use Visual Studio 2010 to do it. I've googled quite a bit but haven't found any information on it. Does anyone have any experience with this and know the steps necessary to make this happen? I have CYGWin installed, made sure i get Make (per the NDK instructions), but i'm not really sure of the next steps in terms of setting up the project, compiler in visual studio, etc.
If anyone knows of any write-ups, tutorials, or links to sample projects, that would be awesome, as there isn't much on google yet.
thanks!
Here's another solution, which integrates the NDK fully within Visual Studio. No makefiles. It behaves like a proper Win32 project:
Here's an excellent blog post about how you can configure your environment to debug android NDK code using Visual Studio.
Visual Studio is officially not supported.
Some problems (but not limited to):
MSVS cannot create the proper ARM binaries
Android makefiles (.mk) are not supported by MSVS
There are however, third party solutions:
vs-android
VisualGDB
You might want to check out DS-5 as well, though it's not Visual Studio.
The answer depends on what kind of integration you require.
To just build the native Android code from Visual Studio you can create a new Makefile project, and make it run ndk-build.cmd when you press "build". If you would like to get the error messages mapped as well, you will need to parse the output of ndk-build.cmd and convert it to a format that Visual Studio can udnerstand.
If you want to debug your native Android code from Visual Studio, you will need a third party tool that will control ndk-gdb on behalf of Visual Studio and provide workarounds for several bugs (e.g. rebind breakpoints when libraries are loaded).
You can try our VisualGDB for Android tool that does exactly that - creates projects that wrap ndk-build and controls NDK debugger on behalf of Visual Studio. If you need more information, there is a step-by-step tutorial available.
I have not found a direct clean solution, here is my workaround.
I develop my native code on VS as a static library, and use some test project to try it as a console aplication.
When it is ok, from cygwin I use a little bash script that copies all needed files to the jni folder and launch the standard android ndk make command. (also copy some file to assets folder when needed), producing the executable in the right folder.
To use the pthreads I have linked my projects to pthreads-win32.
The only files I do not compile in VS are the jni code.
I hope this can help you.
There's also a couple of other third party alternatives for developing ANdroid apps with VS in addition to those above. There is the open source dot42 located at http://www.dot42.com and Remobjects, http://www.remobjects.com , which allows you to program in c#, Pascal, and Swift. I have played with the trial of Remobjects and am now starting to play around with dot42.
My use of the remobjects trial allowed me to recreate in c# the first five chapter projects in the textbook of the Android course I took. I haven't had the same success with dot42 so far but I need to find some time to really give it a chance.