1

So I'm trying to use the jReddit wrapper class because I am developing a reddit app on the android. Here is what I did:

  1. I first went to jreddit and downloaded as a zip
  2. Then I went to eclipse, made a project and copied the files from the extracted folder into the new project. Here's a picture of what it looks like:
    enter image description here
  3. Then I used the build.xml from here and "Ran as Ant" to create a jar file in the dist folder as you can see above
  4. I made my android project and copied the jar file into the lib folder and built the path. The project looks like this:
    enter image description here
  5. Finally, here is my MainActivity.java. Sorry, I couldn't format the code properly on here

There are no errors, so I can run it on the android. However, when I click the login button to activate the function call onClickBtn, before it can even get into the function it throws an error saying: Could not find class 'im.goel.jreddit.user.User', referenced from method com.example.reddit.MainActivity.onClickBtn

Did I not import this jar in correctly or am i just not using it properly? Why is it compiling fine like it can see the user class but when run on the android it doesn't know what it is?

Andrei Sfat
  • 8,440
  • 5
  • 49
  • 69
Richard
  • 5,840
  • 36
  • 123
  • 208
  • Hi, All the things is okey. you just need to create a instance os User class. then you can call any method of that class. e.g. `User redditUser;` before onCreate(); Then you can call `redditUser = new User(usern, passw);` under onClickBtn(); Try this way, may it works. – Vikash Kumar Dec 01 '13 at 08:48
  • @VikashKumar no it still has the same error before entering the function. I put a breakpoint on the first line; at the `String usern = username.getText().toString();` and the error is being thrown before hitting the breakpoint. – Richard Dec 01 '13 at 16:09

1 Answers1

1

Extract the contents to the same folder as your other classes. Usually src.

Or

Go to project properties (Alt + Enter) and select Java Build Path (Left panel). Then select Libraries (Top middle). Click the Add External JARs button and select your jar.

Hullu2000
  • 261
  • 4
  • 19