jellybean / nexus 7 notes / develop branch

Hi folks,

I just went through the setup / install process of OF and wanted to share my results / notes. There is a decent chance some of the “issues” I note below could be mitigated, but at this point I felt it would be good to at least simply document them.

Overall experience with setup pretty good. Since the guides didn’t indicate whether the develop branch in git would work I was expecting it not to work at all frankly. Glad it did. I’m going to look into a few of the bugs found below next before I start any app development.

OF: using develop branch from git
Device: Nexus 7 / Jelly Bean 4.1.1
Dev box OS: OS X
Eclipse: Version: 3.6.2.r362_v20110210-9gF78Gs1FrIGnHDHWkEcopoN8AmxeZflGDGKQi
NDK: vr8
SDK: latest from google, have all the android API versions active.

General comments on setup/docs:

  • Eclipse seems to by default auto-build the workspace. This is a waste of time as you import the projects to your workspace as they will fail. Good idea to make sure you disable that setting in Eclipse preferences
  • Considering I had eclipse already installed, the “you will see a popup asking what workspace to use” is not always the case. But just to be safe I cleared the workspace I had setup and started a new one.
    “g) Start Eclipse: You will see a pop up asking you what workspace to use. Just point it to: openFrameworks/examples/android.”

General comments on the code:

  • the suspend / resume for the examples (hopefully it’s not in the core!) seems a bit buggy across all apps. Can elaborate more if you’re interested.
    • All apps seem to have an input/event crashbug consistently related to when I send many touch inputs. See stack trace.**
      “E/AndroidRuntime(29498):
      /AndroidRuntime(29498): FATAL EXCEPTION: main
      E/AndroidRuntime(29498): java.lang.IllegalArgumentException: pointerIndex out of range
      E/AndroidRuntime(29498): at android.view.MotionEvent.nativeGetAxisValue(Native Method)”

androidAdvanced3DExample - This app doesn’t build

  • make: *** No rule to make target `AndroidInstall’. Stop.
  • make: *** No rule to make target `AndroidRelease’. Stop.

Most apps build/installs/runs OK
androidAssimpExample,
androidAudioExample,
androidEmptyExample,
androidFontExample,
androidPolygonExample
androidTouchExample

** androidCameraExample, androidOpenCVExample - Builds/installs OK, but crashes on launch**

  • both crash immediately on launch, not surprised since the device has no rear camera :slight_smile:
    E/AndroidRuntime(30020): FATAL EXCEPTION: GLThread 771
    E/AndroidRuntime(30020): java.lang.NullPointerException
    E/AndroidRuntime(30020): at cc.openframeworks.OFAndroidVideoGrabber.initGrabber(OFAndroidVideoGrabber.java:63)

androidImageExample - App builds/runs, but doesn’t work properly

  • screen is blank other than title
  • logcat reports “Couldn’t load image from bikers.jpg
    W/OF (30388): ofGLRenderer::draw(): texture is not allocated”

** androidSoundPlayerExample - builds/launches OK, but crashes on launch, but for different reason than camera/video app**

  • E/AndroidRuntime(30976): java.lang.ExceptionInInitializerError
    E/AndroidRuntime(30976): at cc.openframeworks.androidSoundPlayerExample.OFActivity.onCreate(OFActivity.java:19)
    E/AndroidRuntime(30976): at android.app.Activity.performCreate(Activity.java:5008)
    E/AndroidRuntime(30976): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
    E/AndroidRuntime(30976): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
    E/AndroidRuntime(30976): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
    E/AndroidRuntime(30976): at android.app.ActivityThread.access$600(ActivityThread.java:130)
    E/AndroidRuntime(30976): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
    E/AndroidRuntime(30976): at android.os.Handler.dispatchMessage(Handler.java:99)
    E/AndroidRuntime(30976): at android.os.Looper.loop(Looper.java:137)
    E/AndroidRuntime(30976): at android.app.ActivityThread.main(ActivityThread.java:4745)
    E/AndroidRuntime(30976): at java.lang.reflect.Method.invokeNative(Native Method)
    E/AndroidRuntime(30976): at java.lang.reflect.Method.invoke(Method.java:511)
    E/AndroidRuntime(30976): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
    E/AndroidRuntime(30976): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    E/AndroidRuntime(30976): at dalvik.system.NativeStart.main(Native Method)
    E/AndroidRuntime(30976): Caused by: java.lang.UnsatisfiedLinkError: Couldn’t load OFAndroidApp: findLibrary returned null
    E/AndroidRuntime(30976): at java.lang.Runtime.loadLibrary(Runtime.java:365)
    E/AndroidRuntime(30976): at java.lang.System.loadLibrary(System.java:535)
    E/AndroidRuntime(30976): at cc.openframeworks.OFAndroid.(OFAndroid.java:645)

androidVBOExample - fails loading neon library. But app runs
I/OF (31238): java.lang.UnsatisfiedLinkError: Couldn’t load neondetection: findLibrary returned null
I/OF (31238): at java.lang.Runtime.loadLibrary(Runtime.java:365)
I/OF (31238): at java.lang.System.loadLibrary(System.java:535)
I/OF (31238): at cc.openframeworks.OFAndroid.(OFAndroid.java:635)

I’m working on a project that will be 4.1 and higher compatible only.

So far so good, anyway, I can confirm touch input crash. Here’s the issue on GitHub and a fix:
https://github.com/danthemellowman/openFrameworks/commit/2fbfe333ba64fa050be617d158bf877e28b74268

I can’t get the fix to work though.

Also, can I ask how do you restore app state after user pushed the power button? It wipes all the textures, how do I tell the openframeworks c++ code to reload it?

Cool, thanks for pointing out the bugfix. It works for me. I just copied it over the OFAndroid.java file, cleaned my projects and rebuilt.

I’ve also managed to get it work, but now the build system fails with

make[1]: *** [libs/armeabi/libOFAndroidApp.so] Error 1
make: *** [AndroidRelease] Error 2

Do you know what may be the cause? Some linking error?

Are you sure that you’ve highlighted your app folder in eclipse before doing the build? I get weird errors in eclipse if my mouse isn’t in the right spot. Also try a clean all for your workspace.

@michels, thanks for the assistance, no, it wasn’t related to this. Highlighting the project sets {project_loc} in Eclipse, and you’ll get an error if no {project_loc} is set. For those who may face the same error as me, I’ll say that after a couple of days fighting with a compiler (sadly I’m not a makefile expert, to say the least) I found that this error was actually caused by my own improper code, even though the compiler output looked just like there was some OF part that doesn’t wants to get compiled. Sometimes, output you see in Eclipse doesn’t point in the right direction. I still don’t know what was the cause exactly, I’ve refactored my app step-by-step from the ground up and now it works fine.

Can you confirm ofSetLineWidth() doesn’t work on 4.1?