Android Setup - RealSense D435

Hi, I’ve been trying to get Nuitrack to run on Android following this guide.

After some modifications I was able to build and run the project, however it crashes while initializing Nuitrack (Nuitrack.init). Below is the error I get, any help would be appreciated.

Thank you.

Using Pixel 2 XL and Android Studio.

2019-03-27 13:04:41.540 21036-21036/com.xxx.zzz E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xxx.zzz, PID: 21036
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.zzz/com.xxx.zzz.activities.MainActivity}: java.lang.NullPointerException: Attempt to read from field 'android.content.pm.ServiceInfo android.content.pm.ResolveInfo.serviceInfo' on a null object reference
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2951)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6718)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
 Caused by: java.lang.NullPointerException: Attempt to read from field 'android.content.pm.ServiceInfo android.content.pm.ResolveInfo.serviceInfo' on a null object reference
    at com.tdv.nuitrack.sdk.Nuitrack.init(Nuitrack.java:47)
    at com.xxx.zzz.activities.MainActivity.onCreate(MainActivity.kt:96)
    at android.app.Activity.performCreate(Activity.java:7144)
    at android.app.Activity.performCreate(Activity.java:7135)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2931)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086) 
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816) 
    at android.os.Handler.dispatchMessage(Handler.java:106) 
    at android.os.Looper.loop(Looper.java:193) 
    at android.app.ActivityThread.main(ActivityThread.java:6718) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Hi Erik,

We’ll investigate this issue and get back to you as soon as we get some results.

We’ve reproduced your issue. You have to add ‘storage permission’ in your app settings (after the installation).

Hi Olga,

Thank you for looking into it. I have now tried enabling the Storage permissions but it is still crashing with the same error. I also tried uninstalling/reinstalling but the result is the same.

Would it be possible for your team to post a sample Android-specific project online somewhere, maybe Github? I think myself and many others would greatly benefit from having a pre-configured project to reference.

Please advise did you install Nuitrack.apk to your device?

Just to make sure - did you edit storage permissions in your project settings or in your app settings? You have to go to your app settings > permissions > turn on “storage”

Yes, the issue was that I had not installed Nuitrack.apk on that device. After installing and running it (and turning on my app’s storage permission) I was able to successfully run my app and see the the camera view.

Is there a way to package everything installed from the Nuitrack.apk into our app? It would be inconvenient for our users to need to install another app, before our app is able to work.

Note: Pixel 2 XL did not work, I had success on a Galaxy S8+.

Unfortunately, at the time users have to install Nuitrack.apk. Besides, Nuitrack can be activated on Android devices only by running Nuitrack.apk. We’re working on a new licensing system, which will allow developers to distribute the apps developed with Nuitrack in a more convenient way.