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
- App
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?
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.