I cannot add C/C++ Nature to Android project in Eclipse - android

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.

Related

Can I Port a game written With SFML and c++ to android

So , I created an Empty c++ Project In Visual Studio 2019 And Linked The Libraries Non-Staticly
(That Means I Just The Placed The dll's in The Qutput Directory) And Then Closed VIsual Studio And Switched To VSCode And Now I Build The Project Using Devloper Cmd(Of Visual Studio Of Course) and MSBuild I Use SFML To Make The Project And Now Want To Port It Over To Android (Or IOS Or Both Anything Will Work)
Is There Any Way That This Can Happen ? Please Ask Me If You Want Any Other Information
You should install the Mobile Development with C++ package in the Visual Studio Installer. Create a new C++ project using the template Native-Activity Application (Android).
Trying to convert one project type to another is pointless and a waste of your time. However, your old source code can be included in the new project using the various right click actions.

Why don't we have a single file to open an Android Studio Project?

Why don't we have a file similar to the .xcodeproj (for XCode applications) or an .xds (for Sencha Architect Projects) for our Android Studio Project?
I'm pretty sure a good number of you here have experienced the frustration of trying to import a project you see online in order to piece it apart better and learn how it works. I get that we are supposed to Import Android Projects built using Eclipse and Open Android Projects built using Android Studio.
However, why is it that we have to go through File -> Open -> then pick out the directory of the Android Studio app that we want to open? And the thing is, Android Studio doesn't seem to know it's an Android Studio project until it tries to open and build it. In the screenshot I have below, I have the sample Android Studio projects of ARToolKit, but I've only imported two of them.
As you can see, only those I've imported "can be seen as an Android Studio Project" as indicated that they have the Android Studio logo instead of a Folder.
This can be an issue for those just starting to develop in Android Studio on their own and they try and use existing projects (build from Eclipse or Android Studio) and they hit a snag with just trying to import the projects for reference. They might not know that they should import the folder and not the projectname/src subfolder. It adds to the "steep learning curve" that Android Development has if opening/importing projects aren't streamlined to a degree.
To sum up, my question is:
Why don't we have a single file that we can open that would in turn open Android Studio and import and build the project if it isn't built yet?
Android is not iOS. iOS development is only possible in xcode, hence it makes sense they added a shortcut to open it in xcode directly with a .xcodeproj file. Make life easier for iOS developers.
Android development however can be done outside of android studio as well. Eclipse is just one example, there may be other IDE's that support this. This is possible because android has standalone SDKs and tools that third party applications can use. iOS does not.
Imagine you are working on an android project in android studio. Then your boss tells you someone from 3000km away is going to help you. This guy may be using android studio, but maybe he isn't. When there are multiple options that developers can choose from individually, you do not want to pollute version control with files that you are using, but others may not care about. Each their environment.
This is merely a logical conclusion that you can come to by comparing. The "real" reason why this was done can only be answered by the people that created (adapted intellij) android studio.
This has been very frustrating to me too.
I try to give you a "beta" answer, waiting somebody to confirm it to me.
An Android project is just the composition of many parts that in some cases are concurrent to create the apk file.
It's just like what happens for the whole java projects: you have the main/src/java, the main/src/test, the maver or gradle files, the gradle or maven wrapper, the manifest, the configuration etc.
So you won't have a single project, but a series of folders that can contain many "flavours" or "versions" of the product itself.
The only help it is given to us is the Android studio icon that appears if a folder contains an android project in its subfolders.
I don't know if I have really answered to you, I just have given you my impressions and my thought.

How do I begin working on the Project Tango?

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)

can not convert to a c\c++ project eclipse ndk cocos2dx

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.

Add android eclipse library to unity3d project

I have an android library in the form of an eclipse project that I want to integrate with unity3d. I know I can make a jar from eclipse and drop it in unity's plugins/android folder. However as I understand it that necessarily strips out the resources from the project.
If I export the unity game to an eclipse project, I can right-click and add the android project as a library. However I don't like this approach because it doesn't fit with our current automation process - which basically just script's unity's build dialog.
I'd like a way to tell unity that I want this eclipse project linked as an android library on export. Does anyone know a way to do that, or how to pack the resources into the jar or another way of getting this stuff to talk?
One possible way to go is using Unity's Build Player Pipeline. Depending on the platform you are working on you then have to set up a shell script or do your stuff in C#.
It's some year ago that I were a Java/Eclipse expert as I am working on iOS now. The Android Developers page shows some way to manipulate projects via command line.
Maybe the better way to go is using Eclipse switches like --import (s. 1st answer in Create an Eclipse project on the command line? and the link provided) but on the other hand I can't find the switch in the help pages.
Well, not really a bounty answer but maybe some inspiration :-)
The only real answer I've found is that in 4.2, you can drop an eclipse project in plugins/android and it will be linked correctly. Just have to hang on I suppose. :-/

Categories

Resources