0

I currently started developing for the Pepper Robot. Choreagraphe/Python + standard Android SDK works fine.

I have now seen there is a Java SDK to access the Pepper API (ALMemory, ALSpeechToText...) natively:

http://doc.aldebaran.com/2-4/dev/java/index_java.html

What I did so far: I downloaded the library and added it into my Android Project under libs.

My code just contains this:

package com.example.falu.peppertest;

import android.support.v7.app.AppCompatActivity; import android.os.Bundle;

import com.aldebaran.qi.Application; import com.aldebaran.qi.Session;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
}
@Override
protected void onStart()
{
    super.onStart();

    String[] args = new String[]{"qi-url=tcp://falu-sp4.local:9559"};

    //Using official SDK
    try {
        Application app = new Application(args);

    }
    catch(Exception ex) {
        ex.printStackTrace();
    }
} }

In the usage list it says it can be used on ARM Android 4. Unfortunately the Adnroid SDK runs on Android 5 (Lollipop)

Is there a way to use this library there?

If I try I always get the message:

10-23 07:11:57.253 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: GetMethodID received null jclass 10-23 07:11:57.253 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] in call to GetMethodID 10-23 07:11:57.253 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] from java.lang.Object com.aldebaran.qi.DynamicObjectBuilder.object(long) 10-23 07:11:57.253 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] "main" prio=5 tid=1 Runnable 10-23 07:11:57.253 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] | group="main" sCount=0 dsCount=0 obj=0x7490b000 self=0xb4025800 10-23 07:11:57.254 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] | sysTid=3311 nice=0 cgrp=default sched=0/0 handle=0xb7772ea0 10-23 07:11:57.254 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] | state=R schedstat=( 0 0 0 ) utm=15 stm=42 core=0 HZ=100 10-23 07:11:57.254 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] | stack=0xbf099000-0xbf09b000 stackSize=8MB 10-23 07:11:57.254 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] | held mutexes= "mutator lock"(shared held) 10-23 07:11:57.254 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #00 pc 00005d03 /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+83) 10-23 07:11:57.254 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #01 pc 00003051 /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+33) 10-23 07:11:57.254 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #02 pc 003c9e67 /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream >&, int, char const*, art::mirror::ArtMethod*)+135) 10-23 07:11:57.254 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #03 pc 00393222 /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream >&) const+306) 10-23 07:11:57.254 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #04 pc 001029bb /system/lib/libart.so (art::JniAbort(char const*, char const*)+1019) 10-23 07:11:57.255 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #05 pc 0010359c /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+108) 10-23 07:11:57.255 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #06 pc 0010613f /system/lib/libart.so (art::ScopedCheck::CheckInstance(art::ScopedCheck::InstanceKind, _jobject*)+623) 10-23 07:11:57.255 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #07 pc 0010792e /system/lib/libart.so (art::ScopedCheck::Check(bool, char const*, ...) (.constprop.131)+718) 10-23 07:11:57.255 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #08 pc 00115b2d /system/lib/libart.so (art::CheckJNI::GetMethodID(_JNIEnv*, _jclass*, char const*, char const*)+109) 10-23 07:11:57.255 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #09 pc 00097952 /data/app/com.example.falu.peppertest-2/lib/x86/libqimessagingjni.so (JNIObject::build(qi::Object)+82) 10-23 07:11:57.255 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #10 pc 00097dd5 /data/app/com.example.falu.peppertest-2/lib/x86/libqimessagingjni.so (JNIObject::JNIObject(qi::Object)+53) 10-23 07:11:57.255 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #11 pc 0006d3e5 /data/app/com.example.falu.peppertest-2/lib/x86/libqimessagingjni.so (Java_com_aldebaran_qi_DynamicObjectBuilder_object+325) 10-23 07:11:57.256 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #12 pc 000e6221 /system/lib/libart.so (art_quick_generic_jni_trampoline+49) 10-23 07:11:57.256 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #13 pc 000e3bc8 /system/lib/libart.so (art_quick_invoke_stub+72) 10-23 07:11:57.256 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #14 pc 0030bb55 /system/lib/libart.so (art::mirror::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+245) 10-23 07:11:57.256 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #15 pc 00407f73 /system/lib/libart.so (artInterpreterToCompiledCodeBridge+115) 10-23 07:11:57.256 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #16 pc 0024a61b /system/lib/libart.so (bool art::interpreter::DoCall(art::mirror::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+475) 10-23 07:11:57.256 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #17 pc 0043fbaa /system/lib/libart.so (bool art::interpreter::DoInvoke<(art::InvokeType)0, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+266) 10-23 07:11:57.256 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #18 pc 000c3bb5 /system/lib/libart.so (art::JValue art::interpreter::ExecuteGotoImpl(art::Thread*, art::MethodHelper&, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue)+40229) 10-23 07:11:57.256 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #19 pc 002342a4 /system/lib/libart.so (artInterpreterToInterpreterBridge+244) 10-23 07:11:57.257 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #20 pc 0024b037 /system/lib/libart.so (bool art::interpreter::DoCall(art::mirror::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+439) 10-23 07:11:57.257 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #21 pc 0043ee2e /system/lib/libart.so (bool art::interpreter::DoInvoke<(art::InvokeType)2, true, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+414) 10-23 07:11:57.257 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #22 pc 000bb65d /system/lib/libart.so (art::JValue art::interpreter::ExecuteGotoImpl(art::Thread*, art::MethodHelper&, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue)+6093) 10-23 07:11:57.257 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #23 pc 002342a4 /system/lib/libart.so (artInterpreterToInterpreterBridge+244) 10-23 07:11:57.257 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #24 pc 0024a61b /system/lib/libart.so (bool art::interpreter::DoCall(art::mirror::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+475) 10-23 07:11:57.257 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #25 pc 0043f6dc /system/lib/libart.so (bool art::interpreter::DoInvoke<(art::InvokeType)1, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+316) 10-23 07:11:57.257 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #26 pc 000bb888 /system/lib/libart.so (art::JValue art::interpreter::ExecuteGotoImpl(art::Thread*, art::MethodHelper&, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue)+6648) 10-23 07:11:57.257 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #27 pc 002342a4 /system/lib/libart.so (artInterpreterToInterpreterBridge+244) 10-23 07:11:57.257 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #28 pc 0024a61b /system/lib/libart.so (bool art::interpreter::DoCall(art::mirror::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+475) 10-23 07:11:57.258 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #29 pc 0043eb2e /system/lib/libart.so (bool art::interpreter::DoInvoke<(art::InvokeType)2, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+414) 10-23 07:11:57.258 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #30 pc 000c1a4d /system/lib/libart.so (art::JValue art::interpreter::ExecuteGotoImpl(art::Thread*, art::MethodHelper&, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue)+31677) 10-23 07:11:57.258 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #31 pc 002339a3 /system/lib/libart.so (art::interpreter::EnterInterpreterFromStub(art::Thread*, art::MethodHelper&, art::DexFile::CodeItem const*, art::ShadowFrame&)+195) 10-23 07:11:57.258 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #32 pc 00434a88 /system/lib/libart.so (artQuickToInterpreterBridge+872) 10-23 07:11:57.258 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #33 pc 000e62b2 /system/lib/libart.so (art_quick_to_interpreter_bridge+34) 10-23 07:11:57.258 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #34 pc 000e3bc8 /system/lib/libart.so (art_quick_invoke_stub+72) 10-23 07:11:57.258 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #35 pc 0030bb55 /system/lib/libart.so (art::mirror::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+245) 10-23 07:11:57.259 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #36 pc 00149db0 /system/lib/libart.so (art::ClassLinker::InitializeClass(art::Handle, bool, bool)+1312) 10-23 07:11:57.259 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #37 pc 0014ac4c /system/lib/libart.so (art::ClassLinker::EnsureInitialized(art::Handle, bool, bool)+108) 10-23 07:11:57.259 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #38 pc 000c6d15 /system/lib/libart.so (art::JValue art::interpreter::ExecuteGotoImpl(art::Thread*, art::MethodHelper&, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue)+52869) 10-23 07:11:57.259 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #39 pc 002339a3 /system/lib/libart.so (art::interpreter::EnterInterpreterFromStub(art::Thread*, art::MethodHelper&, art::DexFile::CodeItem const*, art::ShadowFrame&)+195) 10-23 07:11:57.259 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #40 pc 00434a88 /system/lib/libart.so (artQuickToInterpreterBridge+872) 10-23 07:11:57.259 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #41 pc 000e62b2 /system/lib/libart.so (art_quick_to_interpreter_bridge+34) 10-23 07:11:57.259 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #42 pc 00852ca5 /data/dalvik-cache/x86/system@framework@boot.oat (???) 10-23 07:11:57.259 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #43 pc 98fe3802 ??? 10-23 07:11:57.259 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #44 pc 54984e1f ??? 10-23 07:11:57.260 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] native: #45 pc 9f0097a1 ??? 10-23 07:11:57.260 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at com.aldebaran.qi.DynamicObjectBuilder.object(Native method) 10-23 07:11:57.260 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at com.aldebaran.qi.DynamicObjectBuilder.object(DynamicObjectBuilder.java:118) 10-23 07:11:57.260 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at com.aldebaran.qi.EmbeddedTools.initTypeSystem(EmbeddedTools.java:46) 10-23 07:11:57.260 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at com.aldebaran.qi.EmbeddedTools.loadEmbeddedLibraries(EmbeddedTools.java:148) 10-23 07:11:57.260 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at com.aldebaran.qi.Session.(Session.java:16) 10-23 07:11:57.260 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at com.example.falu.peppertest.MainActivity.onStart(MainActivity.java:22) 10-23 07:11:57.260 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1236) 10-23 07:11:57.260 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at android.app.Activity.performStart(Activity.java:6026) 10-23 07:11:57.260 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2296) 10-23 07:11:57.261 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395) 10-23 07:11:57.261 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at android.app.ActivityThread.access$800(ActivityThread.java:151) 10-23 07:11:57.261 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1311) 10-23 07:11:57.261 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at android.os.Handler.dispatchMessage(Handler.java:102) 10-23 07:11:57.261 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at android.os.Looper.loop(Looper.java:135) 10-23 07:11:57.261 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at android.app.ActivityThread.main(ActivityThread.java:5398) 10-23 07:11:57.261 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at java.lang.reflect.Method.invoke!(Native method) 10-23 07:11:57.261 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at java.lang.reflect.Method.invoke(Method.java:372) 10-23 07:11:57.261 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 10-23 07:11:57.262 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 10-23 07:11:57.262 3311-3311/com.example.falu.peppertest A/art: art/runtime/check_jni.cc:65] 10-23 07:11:57.365 3311-3311/com.example.falu.peppertest A/art: art/runtime/runtime.cc:289] Runtime aborting...

Thanks!

Fabio Lucia
  • 85
  • 1
  • 5
  • `GetMethodID received null jclass` - you pass NULL instead of `jclass` to the method `GetMethodID` in your 'com.example.falu.peppertest' app. Try to use a debugger. And post your code if you need more help. – Dima Kozhevin Oct 23 '17 at 07:25
  • Hi! This all happens inside the pepepr java library I use. in code, the only thing I do is this: Session session = new Session(); //com.aldebaran.qi.Session; – Fabio Lucia Oct 23 '17 at 07:28
  • Could you show us how do you use this library? – Dima Kozhevin Oct 23 '17 at 07:31
  • http://doc.aldebaran.com/2-4/dev/java/index_java.html – Fabio Lucia Oct 23 '17 at 07:46
  • I also tried this in the Adnroid App - same result: String[] args = new String[]{"qi-url=tcp://falu-sp4.local:9559"}; //Using official SDK try { Application app = new Application(args); } catch(Exception ex) { ex.printStackTrace(); } – Fabio Lucia Oct 23 '17 at 07:50
  • Could you add this additional information through editing your question for doing your question more readable? – Dima Kozhevin Oct 23 '17 at 08:30
  • Sure, sorry. Just added it. – Fabio Lucia Oct 23 '17 at 09:14
  • You tried to use it on `x86` as i see in your log `/data/app/com.example.falu.peppertest-2/lib/x86/libqimessagingjni.so ` but doc says **`Available on Android 4.0 for ARM`**. – Dima Kozhevin Oct 23 '17 at 09:21
  • I think you should use the Pepper SDK for android instead: https://android.aldebaran.com/sdk/doc/pepper-sdk/introduction.html – JLS Oct 23 '17 at 16:06

1 Answers1

0

The Pepper Java SDK uses compiled native binaries (.so on Linux/Android, I guess .dll on Windows) which means the jar file is not portable in the same way most are.

On earlier versions of this SDK it just had binaries for the target platform (E.g. Pepper's Linux) so it just won't work on the tablet unless you replace the .so files. The latest version does seem to detect Android and switches to different binaries but still I couldn't get it to work and notably it's not put forward as suitable for the tablet.

There is an Android SDK

http://android.aldebaran.com/sdk/doc/pepper-sdk/introduction.html

Whether this will be compatible with your version of Naoqi is another matter, I was able to get it working with the emulator and virtual robot but it seems the Naoqi that comes down with the plugin has different services compared to the Pepper I have access to.

Edd
  • 11
  • 2
  • Yes, I also think there was a change in the past. Unfortunately, by using the latest SDK there is no way to access the NaoQI API: http://doc.aldebaran.com/2-5/naoqi/index.html Did you find a way to use for example a raised event? – Fabio Lucia Oct 26 '17 at 11:47
  • The latest plain Java SDK should work, as in calls to com.aldebaran.qi.helper.proxies.ALMemory where you have subscribeToEvent BUT this is an SDK to use on the robots main computer or an external computer not the tablet. The tablet is the Android SDK which at the moment seems to be for a later Naoqi and since it relies on Android services (you'll see them in the emulator) to manage the API calls it's going to be difficult to compensate for a different Naoqi version. – Edd Oct 27 '17 at 12:40
  • One more thing, did you ever use the previous version of the plugin (0.9 I think)? If so try a project using the old build.gradle settings, depending on your robot's version this may give you some access. – Edd Oct 27 '17 at 12:46