android project setup "'ofAndroidLib' is missing required source folder: 'gen'"

When I try to configure Android directly from git I get this:

‘ofAndroidLib’ is missing required source folder: ‘gen’

Removing references to “gen” I get:

Project has no project.properties file! Edit the project properties to set one. ofAndroidLib Unknown Android Target Problem

Anyone familiar with this? Unhappily it screws up my entire workspace, so I have to clean house and redo everything from the beginning. It’d be pretty rad if the “Getting started” page made some mention of this, since this is the exact same problem I ran into last time I thought I wanted to do Android development. I don’t have the luxury of just giving up this time, unfortunately.

This is my own fault, I just downloaded the specifically C/C++ version of Eclipse rather than just installing CDT and everything works. Not sure what the difference is, but if you run into this problem, you might want to try the specifically C++ eclipse release. I do still get the following errors though:

Description Resource Path Location Type
Function ‘CGLGetCurrentContext’ could not be resolved ofAppRunner.cpp /openFrameworks/app line 369 Semantic Error

Ok, one more, trying to debug an actual project, I get:

make[1]: *** No rule to make target ../../../libs/openFrameworksCompiled/lib/android/libopenFrameworks.a', needed bylibs/armeabi/libOFAndroidApp.so’. Stop.

which I’m guessing is why when the app is loaded onto a phone, it just crashes :confused:

== edit (jaysus)

Fixed by copying the libs from the download into ofCompiled/lib/android so that builds all the way and reports that it’s fine, but getting:

04-23 23:21:32.719: I/ActivityManager(2696): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=cc.openframeworks.androidEmptyExample/.OFActivity } from pid 2876
04-23 23:21:32.724: I/WindowManager(2696): CREATE SURFACE Surface(name=Starting cc.openframeworks.androidEmptyExample, identity=48, mNativeSurface=0) IN SESSION android.view.SurfaceSession@4095abf0: pid=2696 format=-1 flags=0x0 / Window{409a8420 Starting cc.openframeworks.androidEmptyExample paused=false}
04-23 23:21:32.754: I/ActivityManager(2696): Start proc cc.openframeworks.androidEmptyExample for activity cc.openframeworks.androidEmptyExample/.OFActivity: pid=5171 uid=10124 gids={1015}
04-23 23:21:32.814: D/dalvikvm(5171): Trying to load lib /data/data/cc.openframeworks.androidEmptyExample/lib/libneondetection.so 0x4051d4d0
04-23 23:21:32.814: D/dalvikvm(5171): Added shared lib /data/data/cc.openframeworks.androidEmptyExample/lib/libneondetection.so 0x4051d4d0
04-23 23:21:32.814: D/dalvikvm(5171): No JNI_OnLoad found in /data/data/cc.openframeworks.androidEmptyExample/lib/libneondetection.so 0x4051d4d0, skipping init
04-23 23:21:32.814: D/dalvikvm(5171): Trying to load lib /data/data/cc.openframeworks.androidEmptyExample/lib/libOFAndroidApp_neon.so 0x4051d4d0
04-23 23:21:32.819: I/OF(5171): at cc.openframeworks.OFAndroid.(OFAndroid.java:542)
04-23 23:21:32.819: I/OF(5171): at cc.openframeworks.androidEmptyExample.OFActivity.onCreate(OFActivity.java:19)
04-23 23:21:32.819: D/dalvikvm(5171): Trying to load lib /data/data/cc.openframeworks.androidEmptyExample/lib/libOFAndroidApp.so 0x4051d4d0
04-23 23:21:32.819: W/dalvikvm(5171): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcc/openframeworks/OFAndroid;
04-23 23:21:32.819: E/AndroidRuntime(5171): at cc.openframeworks.androidEmptyExample.OFActivity.onCreate(OFActivity.java:19)
04-23 23:21:32.819: E/AndroidRuntime(5171): at cc.openframeworks.OFAndroid.(OFAndroid.java:549)
04-23 23:21:32.819: W/ActivityManager(2696): Force finishing activity cc.openframeworks.androidEmptyExample/.OFActivity
04-23 23:21:34.824: W/ActivityManager(2696): Activity pause timeout for HistoryRecord{40b04cb0 cc.openframeworks.androidEmptyExample/.OFActivity}
04-23 23:21:37.984: I/ActivityManager(2696): Process cc.openframeworks.androidEmptyExample (pid 5171) has died.

rather unexciting.

the second error you are getting, the one in ofAppRunner seems to be related to the compiler trying to compile the desktop version instead of the android one, check the menu in the hammer button to see that the correct target is selected. also in osx i’ve seen that error when the path to the project has any spaces in it since the makefiles cannot handle spaces very well

make[1]: *** No rule to make target ../../../libs/openFrameworksCompiled/lib/android/libopenFrameworks.a', needed bylibs/armeabi/libOFAndroidApp.so’. Stop.

this is because you haven’t compiled the openframeworks project yet. once you compile it the error will go away

the last error is probably related to the ndk version, are you using ndkr7? i fixed the makefiles for r7 but only emptyExample is fixed by now so you’ll need to start from that one. i’ll try to fix the rest of the projects next week

I also encounter the problem that ‘ofAndroidLib’ is missing required source folder: ‘gen’. I’m not sure if it has much impact on anything, cause after compiling this error disappears. It’s back again after either a restart or clean or Eclipse closing/opening, though (haven’t yet diagnosed which of the three).

I’m using github develop and Eclipse IDE for C/C++ Linux Developers, Version: Indigo Service Release 2.

w.r.t. to the gen folder, we maybe should add this to the git repo to make sure it doesn’t get a derived flag: http://stackoverflow.com/a/5722984/599884
Haven’t tested this yet, but maybe it gives Arturo an idea on how to best fix this?

One more quick question, when I tried to import “openFrameworks/addons/ofxAndroid/ofAndroidLib” I get:

No projects are found to import

Any ideas? I could just make a .project file but that doesn’t seem right.

mmh, that’s weird there should be a .project file there, is this with the 0071 download or github? there could be a problem in the downloadable package

I just took a look. it’s there on both github branches, but not in the android download on OF.cc

I just reported the missing .project at https://github.com/openframeworks/openFrameworks/issues/1394