0

I'm trying to explore haptics using android via immersion sdk. (downloaded jar version= 3.6)

Reference: http://www2.immersion.com/developers/index.php?option=com_content&view=category&layout=blog&id=119&Itemid=592

i have the following code (sample app provided by immersion)

protected TextView mTxtOut;
protected Launcher mLauncher;

public void onCreate(Bundle savedInstanceState) {
    System.out.println("abc");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mTxtOut = (TextView)findViewById(R.id.txtOut);

    try {
        mLauncher = new Launcher(this);
    } catch (Exception e) {
        Log.e("My App", "Exception!: " + e.getMessage());
    }

}

@Override
public void onDestroy() {
    super.onDestroy();
}

public void btnPlayEffectClicked(View view) {       
    mTxtOut.setText("Playing built-in effect:\n. Effect: DOUBLE_STRONG_CLICK_100.");

    try {
        mLauncher.play(Launcher.DOUBLE_STRONG_CLICK_100);
    } catch (Exception e) {
        mTxtOut.append("Error: " + e.getMessage());
    }
}

As soon as i launch the application, i get an error message "Unfortunately, MyFirstHapticApp has stopped".

I get the following exception "Could not find class com.immersion.uhl.Launcher referenced from method com.example.myfirsthapicapp.MyFirstHapticAppActivity.onCreate" at line mLauncher = new Launcher(this); in LogCat.

I've looked at http://www2.immersion.com/developers/index.php?option=com_kunena&func=view&catid=2&id=170&Itemid=0 but was not helpful.

user720694
  • 2,035
  • 6
  • 35
  • 57
  • 1
    If you are on the R22 or higher version of the Android developer tools, take a look at: http://stackoverflow.com/questions/16596969/libraries-do-not-get-added-to-apk-anymore-after-upgrade-to-adt-22/16596990#16596990 – CommonsWare Jun 04 '13 at 11:17

1 Answers1

1

Have you looked at The Haptic Guide?

Specifically this.

Basically you need to make sure that both UHL.jar and libImmEmulatorJ.so are loaded. The second link provides instructions to do both.

Kano
  • 388
  • 5
  • 11
  • Yes. I followed the same links to setup eclipse for haptic applications. – user720694 Jun 08 '13 at 18:06
  • Ok, I was able to reproduce your problem. There are 2 solutions to this problem: 1. As @CommonsWare suggested, go to your Build Path-> Order and Export tab and select UHL.jar. 2. Put the UHL.jar in the libs folder of your project. This should work. Also if you go to the Haptic Guide link I provided, there is a Haptic QuickStart link on the right of the page. Step 2 in that pdf talks about this issue. – Kano Jun 10 '13 at 17:25
  • SOrry, i was not able to try that. But thank you for your reply and for reproducing the problem. Sometime ago i had tried the solution recommended by commonsware and it worked out fine. Upvoted. – user720694 Jun 15 '13 at 14:46