0

My code reads

import android.os.Bundle;
import rita.wordnet.RiWordnet;
import java.util.*;
import android.app.Activity;
import android.content.IntentSender;
import android.view.Menu;
import android.widget.TextView;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    TextView strlab;
    strlab=(TextView)findViewById(R.id.textView1);
    RiWordnet wordnet = new RiWordnet();
    String word = "diode";
    System.out.println("\nFinding parts of speech for " + word + ".");
    String[] partsofspeech = wordnet.getPos(word);
    for (int i = 0; i < partsofspeech.length; i++) {
        strlab.setText(""+partsofspeech[i]);            
    }


}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}
}

It compiles fine. I'm using the latest version of the Android SDK ADT bundle for windows available. When ever i run the app it stops unexpectedly.

I'm using RITA Wordnet jar files. I added them by simply copying them to libs folder.

I understand the jar files needs java 5.0 or 6.0. So I changed the setting to 1.6 in the Java compiler options in the project properties. I also understand the "order and export" method of adding jars is out-dated.

Can someone please help me ?

Edit: Adding screenshots of my log cat

enter image description here

enter image description here

Srini
  • 1,619
  • 1
  • 19
  • 34

2 Answers2

0

From the stacktrace above, it seems you need more dependencies. In your case the Java WordNet Library.

http://mvnrepository.com/artifact/net.sf.jwordnet/jwnl

Do you have this one inside your classpath?

Eduardo Briguenti Vieira
  • 4,351
  • 3
  • 37
  • 49
  • But when compiled as a stand alone Java application in Eclipse it works fine and produces the desired output!. Download the JWNL jar and adding it to libs results in "[2014-02-06 15:41:32 - Dex Loader] Unable to execute dex: Multiple dex files define Lnet/didion/jwnl/JWNL$OS; [2014-02-06 15:41:32 - Dtester] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lnet/didion/jwnl/JWNL$OS;" – Srini Feb 06 '14 at 10:12
  • Try to do this for this last problem: http://stackoverflow.com/questions/7870265/unable-to-execute-dex-multiple-dex-files-define-lcom-myapp-rarray – Eduardo Briguenti Vieira Feb 06 '14 at 10:16
  • It seems this last problem is caused when you have more versions of the same class in your classpath. – Eduardo Briguenti Vieira Feb 06 '14 at 10:17
  • yes I checked. nothing has been included twice. cleaned and fixed the class path twice :( – Srini Feb 07 '14 at 03:59
0

Go to Poject Explorer in Eclipse then select Property->Java Build Path ->Order and Export then checked only tick marks on Android Private Libraries and Android Dependencies and unchecked all jar files there if it was checked before.Tell us if it is working or not.

Abhijit Chakra
  • 3,201
  • 37
  • 66