2

I'm attempting to build an android app in Android Studio that integrates the jReddit Java Wrapper. I've cloned the git repository, added a build.gradle file, added the proper dependencies and referenced the jReddit module in my android app's project structure.

I'm able to create any of the objects in the jReddit library, but I cannot use any of the methods for those objects. I get a "Cannot resolve symbol 'xxx'" when I try to use a method. Currently the project structure is set up like below:

  • Project Title
    • App
      • src
      • libs
    • jReddit
      • src
      • libs

So the app's code is in the src folder and any .jar dependencies are in the libs folder. The jReddit project has in it's build.gradle file "apply plugin: 'java'" and is listed as a dependency in the app's build.gradle file. Finally the libs folder in the jReddit project tree has the jars that IT depends on (which are also referenced in its respective build gradle).

Ultimately, everything compiles nicely, is imported nicely (in the app source code), there are no errors instantiating a new object from the jReddit library, but when I go to do anything with that object, Android Studio cannot find any methods. See the screen shots below to see what I'm talking about:

https://i.stack.imgur.com/IJ4N2.png

I'm completely dumbfounded with what to do here. I've never encountered anything like this. Does anyone have any suggestions?

Andrei Sfat
  • 8,440
  • 5
  • 49
  • 69
mdaguillo
  • 31
  • 3
  • Please edit your question and provide an example of the error(s) in text. This helps people searching for the same problem. – simo.3792 Nov 18 '14 at 23:24
  • Are you sure you are bundling your jar with your project? Might be related to [this question](http://stackoverflow.com/questions/8231059/android-cant-find-class-from-external-jar) – Joeblade Nov 18 '14 at 23:19
  • 1
    @mdaguillo, why would you want to include the whole jreddit project inside your own project and why not use instead the jar (either by manually downloading it from the maven central repo, although I don't recommand this or including it using maven/gradle) – Andrei Sfat Apr 06 '15 at 13:46
  • @sfat I'm sorry for never responding to your comment. I actually was using a jar that I found in a maven repository, but it was not the most up to date version. I figured the best thing I could do was checkout the latest project from github and reference in the build for my app. Ultimately, this proved to be more useful, since I had to make some changes to the latest build's code to handle some of reddits features that weren't yet implemented. – mdaguillo Jun 19 '15 at 13:36
  • @mdaguillo if you checkout the github repo and see some features that you are willing share your code regarding those features and aren't in the project yet, feel free to open up a pull request. – Andrei Sfat Jun 19 '15 at 14:32

1 Answers1

0

So this is a very old post but I never followed up on this. It turns out, I had done everything correctly, but I was attempting to access the objects methods outside the scope of a function (either main or otherwise). Moving the code into the main function fixed the issue.

mdaguillo
  • 31
  • 3