Search code examples
androidcjava-native-interfaceubuntu-14.04google-project-tango

How to debug Project Tango C examples


I'm using Ubuntu 14.04, I cloned the c examples github repo. I have ADT Eclipse installed, and I also installed C/C++ plugins. I can import the example projects as Android projects. I tried the PointCloud example and the augmented reality example so far. I can start a debug session as an Android app, and I can select my Tango tablet device. I can see this error messages on the top in logcat view:

01-20 00:09:05.583: A/art(5250): art/runtime/thread.cc:1011] No pending exception expected: java.lang.UnsatisfiedLinkError: Couldn't load point_cloud_jni_example from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/libtango_device.jar", zip file "/data/app/com.projecttango.experiments.nativepointcloud-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.projecttango.experiments.nativepointcloud-1, /system/lib, /vendor/lib, /system/lib]]]: findLibrary returned null

At the same time on the tablet I'm presented with the dialog to give rights to the app, which I give, but then the app immediately stops.

  1. Should I use Eclipse ADT, or can I use Android Studio (IntelliJ) somehow?
  2. Should I import the projects as Android projects? (I think yes).

What looks weird in the error message to me is mention of dalvik. I thought Tango applications should be ART ones, but the error message mentions Dalvik (while seemingly the ART runtime tries to load it). Is that the problem? How can I fix that?


Solution

  • OK, so I just needed to do some homework. As described here: https://developers.google.com/project-tango/apis/c/c-getting-started

    1. I changed the current directory to the desired C example project (root). Then I had to say <ndk_path>/ndk-build. That compiled the so files containing the JNI related part. For example in case of the point-cloud-jni-example, within the libs directory an armabi-v7a directory is created and within that a libpoint_cloud_jni_example.so and a libtango_client_api.so file is created/compiled/placed. Note that I had the NDK installed already.

    2. I reopened the project in ADT Eclipse and refreshed (right click in the Project explorer on the root node and refresh). After that I still had an error message, that it cannot find the Android manifest. Which is stupid, because it's right there. To trigger some action I adjusted the target SDK version to 20 in the Android manifest. Note that if you set the minimum SDK version to 20, the Tango device won't show up in the AVD, because it's API level is 19, just sayin' :)

    Anyhow, after that I managed to run the project as an Android app. Also note that the github repo referenced in the c-getting-started does not exist any more. We can say that the "hello world" is now the hello-tango-jni-example project.