Android: Eclipse vs. Android Studio? Which set up do you have and why?

Hey guys,
Trying out openFrameworks on Android - I know there are few ways to set up an IDE (Android Studio, Eclipse). I have set up Android Studio and was able to get run everything, I was even able to get the C++ code highlighting working through an IntelliJ C++ plugin… But there is no autocomplete and C++ imports aren’t being recognized leading to meaningless errors in the IDE. So I did some research into Eclipse IDE and it seems to use an older version of Eclipse and Ant instead of Gradle, as outlined here. So my question to those of you who have spent significant amount of time working with openFrameworks on Android and kept their sanity - what setup did you end up using? Thanks!

Hi, I have used both.
Eclipse used to work fine until I was unable to find the suitable version of it (the last time I tried to install it, some months ago). Besides that I remember that it worked quite well.
android studio has a lot of odd stuff.
check out this for android studio.

are you able to build and run the androidEmptyExample?

best

Thanks for your time! Yes, I am able to build and run androidEmptyExample with Android Studio. When you were working with Eclipse, did it fully support C++? As in, did autocomplete work? Were you able to debug C++ code? Thanks

Hi, I think that autocomplete used to work on Eclipse. Not sure. The last time I tried to install it I was unable to find the Eclipse version for mobiles with C++, as there used to be one. Yes, I was able to debug with both, Eclipse and Android Studio.
Which bundle of Eclipse are you using?

As for android studio, creating a new project is not as simple as duplicating the androidEmptyExample.
After duplicating and giving a new name to that folder you MUST change every place that says androidEmptyExample for the name you gave to the duplicated folder. There is even a folder inside srcJava that you must rename.
Once you’ve done this you will be able to compile your new project by right clicking on its folder in the project navigator an selecting “build component”
to find all the places where emptyExample appears try the following in terminal

cd your/project/directory/path
find ./ -name "*.*" | xargs grep -i -C 1 --color "androidEmptyExample"

best

Due to mass customization, we still stick with Ubuntu 12.04+Eclipse Kepler SR2+ADT+openFrameworks 0.8.0.

Everything works fine, even on the Android 5.0 Lollipop devices despite the ART headache. But as I wrote above, we have a mass customization either in the codelines and in the usage style. What I mean is;

In the normal (tutorialized) usage of openFrameworks, we had a lot of issue: Red underlines, not recognized headers, long compiling times, no auto-complete, etc… Then we compiled openFrameworks as a shared library. We started a native project and we added openFrameworks to the project as a shared library. Now everything work like a charm. Then we developed a lot of thing on this customized version. The full version of our game reached 140 MB. We use now almost each method of openFrameworks. And we are still a lot of thing to implement/fix.

We didn’t test Android Studio version yet. I feel it doesn’t have enough support for big projects yet. But I am not sure. We will test it if we can find a free time.

Thanks for your time guys.
@roymacdonald - I have not tried setting up Eclipse yet, just setup Android Studio, and it compiles and runs example projects fine - however, I have not been able to debug C++ code at all in Android Studio. Breakponts just aren’t hit. Do you recall having to set something up specifically for that?
@Rancs - The issues you describe for “tutorized usage” of the OF with Android are the exact same issues I am trying to avoid because it isn’t an env. i can imagine doing any kind of serious work in. I will try setting everything up in a manner you described. Thanks for sharing!

@Rancs So I dug in into this today, and I realized that I could use a little more info, if you have a little time. If I understand you correctly, you have created a native Android project, wrapped OF library in a JNI and added it to the project. Is that is correct? I am wondering did you guys actually write JNI wrapper for the entire library so it can be called from Java or you still write C++ code to interact with it? Thanks

Yes we created a native Android project.
Yes, we write with C++.
We have libOFAndroidApp.so under project/lib/armeabi
We have main.cpp, testApp.cpp and testApp.h in the project/jni

If you need I can explain how to setup step by step.

+1 for a step by step guide!

If you wouldn’t mind putting together a step-by-step tutorial, it would be great!! I think a lot of people will really benefit from it.

Ok, I start it, but it may be a little confusing. You are free to continue with the normal way whenever you want :slight_smile:

As it is a long story, I will write it in a few parts.

I moved 3 posts to a new topic: Alternative Android Development Guide: Step-by-step Instructions

Thanks a lot! I will try this the first chance I get.

Hey @Rancs This is great. I moved the posts to a new topic to make it a little easier to follow. Please continue there.

Thanks!!

Also – please feel free to change the title … I wasn’t exactly sure what to call it.

Thanks. The title is very explanatory.

I will add soon also some howtos about adding resources, ofxaddons, jni commands, handling pause-resume cycles and updating the openframeworks library.

1 Like

@Rancs, are you able to use breakpoints with your setup? That is one of the big headaches I have found with using Eclipse together with openFrameworks, the inability to debug and step into the code.

Yes, of course. The only thing we do here is, changing the format of the Eclipse project.

We change the Eclipse project format from the openFrameworks style to a conventional Android NDK style. So everything work flawlessly for native Android development.