cancel
Showing results for 
Search instead for 
Did you mean: 

UnsatisfiedLinkError when running new native template app

digital_da
Explorer
Hi,

I'm creating a new template project based on the instructions https://developer.oculus.com/documentation/mobilesdk/latest/concepts/mobile-new-apps-intro/#mobile-n...

and when I run the app I'm getting an UnsatisfiedLinkError and a notice saying the app closed unexpectedly 😮

Any help would be appreciated!

logcat
--------

07-16 15:05:25.242: E/AndroidRuntime(10631): FATAL EXCEPTION: main
07-16 15:05:25.242: E/AndroidRuntime(10631): Process: oculus.vrtemplate, PID: 10631
07-16 15:05:25.242: E/AndroidRuntime(10631): java.lang.UnsatisfiedLinkError: No implementation found for long
oculus.vrtemplate.MainActivity.nativeSetAppInterface(com.oculus.vrappframework.VrActivity, java.lang.String, java.lang.String, java.lang.String)
(tried Java_oculus_vrtemplate_MainActivity_nativeSetAppInterface and Java_oculus_vrtemplate_MainActivity_nativeSetAppInterface__Lcom_oculus_vrappframework_VrActivity_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2)
07-16 15:05:25.242: E/AndroidRuntime(10631): at oculus.vrtemplate.MainActivity.nativeSetAppInterface(Native Method)
07-16 15:05:25.242: E/AndroidRuntime(10631): at oculus.vrtemplate.MainActivity.onCreate(MainActivity.java:39)
07-16 15:05:25.242: E/AndroidRuntime(10631): at android.app.Activity.performCreate(Activity.java:6374)
07-16 15:05:25.242: E/AndroidRuntime(10631): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
07-16 15:05:25.242: E/AndroidRuntime(10631): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2767)
07-16 15:05:25.242: E/AndroidRuntime(10631): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2879)
07-16 15:05:25.242: E/AndroidRuntime(10631): at android.app.ActivityThread.access$900(ActivityThread.java:182)
07-16 15:05:25.242: E/AndroidRuntime(10631): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1475)
07-16 15:05:25.242: E/AndroidRuntime(10631): at android.os.Handler.dispatchMessage(Handler.java:102)
07-16 15:05:25.242: E/AndroidRuntime(10631): at android.os.Looper.loop(Looper.java:145)
07-16 15:05:25.242: E/AndroidRuntime(10631): at android.app.ActivityThread.main(ActivityThread.java:6141)
07-16 15:05:25.242: E/AndroidRuntime(10631): at java.lang.reflect.Method.invoke(Native Method)
07-16 15:05:25.242: E/AndroidRuntime(10631): at java.lang.reflect.Method.invoke(Method.java:372)
07-16 15:05:25.242: E/AndroidRuntime(10631): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
07-16 15:05:25.242: E/AndroidRuntime(10631): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

Manifest
-----------

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="oculus.vrtemplate"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
<!-- Allow reading of the appropriate lens distortion file for the device. -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Needed for pass-through camera -->
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.usb.host" />
<!-- Tell the system this app requires OpenGL ES 3.0. -->
<uses-feature android:glEsVersion="0x00030000" android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
<!-- launchMode is set to singleTask because there should never be multiple copies of the app running -->
<!-- Theme.Black.NoTitleBar.Fullscreen gives solid black instead of a (bad stereoscopic) gradient on app transition -->
<activity
android:name="MainActivity"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="landscape"
android:configChanges="orientation|screenSize|keyboard|keyboardHidden">
<!-- This filter lets the apk show up as a launchable icon -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
6 REPLIES 6

Anderwulf
Honored Guest
Hey digital_da, I'm trying to repro your issue locally, but cannot.

I grabbed the 0.6.0.1 SDK, ran
./make_sdk_project.sh VrTestApp YourCompanyName
and built with
python build.py
and the app ran perfectly, showing a green screen.

Are you building on Windows, OSX, or Linux? Also, it looks like you might have made some modifications to the code. Can you describe them, or better yet post a diff or a zip with your changes in them?

digital_da
Explorer
I'm running on Windows 8.1. I ran the make_new_project.bat file and then built using eclipse and tried to run.

Anderwulf
Honored Guest
I don't have Eclipse set up yet, but I'm curious - do you see the same error when building with
build.bat
instead of Eclipse? Also, just to confirm, are you running it in the VrTemplate directory or the one with the new app?

Also, can you list what changes you made to the template app? I don't think the scripts can set the package name to "oculus.vrtemplate". Did you change the package name in MainActivity.java from "oculus" to "oculus.vrtemplate"?

digital_da
Explorer
Hi,
When I use build.bat from the directory of the new project and I get the same results.
Regarding the name of the package - oculus.vrtemplate is the name I get generated for my package name whatever package name I type in make_new_project. The name I use is the make_new_project script gets copied to Android Manifest but if I try to run it I get an error that no implementation has been found for <mypackageName>. MainActivity so I manually change the name in the manifest.

Anderwulf
Honored Guest
So the error seems to be because MainActivity.java has the package
oculus.vrtemplate
instead of
oculus
which cause the JVM to look for
 Java_oculus_vrtemplate_MainActivity_nativeSetAppInterface
in OvrApp.cpp. I don't believe the setup script modifies that file so it should have the name
Java_oculus_MainActivity_nativeSetAppInterface
after the script has run and thus the lookup fails. If you change the name of the C++ function to what it's looking for, or change the package in MainActivity.java back to oculus then it should work.

Are you able to build and run the sample application in VrSamples/Native/VrCubeWorld_Framework? I'm trying to figure out if this is just an issue with VrTemplate for you.

digital_da
Explorer
Hi,

Thank you! It was an issue of an inconsistency between the package name and the function name. I was able to build and run the VrCubeWorld_Framework.