0

I want to include the guava-07.jar in my project.I tried configuring build paths,copying it to library folder,linking source and used add external jars.

The import com.google.common.eventbus.Subscribe cannot be resolved keeps showing. I have a project with guava.jar in its private library.Can I put that in this project.Or is there another problem.Please help me understand.

Ravi Bhatt
  • 1,870
  • 1
  • 14
  • 27
ajarmani
  • 269
  • 1
  • 2
  • 9

3 Answers3

1

after referring some questions in stack and in google, i got something like this hope these may help you

as you have done before just remove all your dependencies and add build path and clean project once if it dint work just go through the things

The easiest way to deal with such a library in Eclipse is to create a User library and add the user library to your project (right click project: Build Path -> Add Library -> User Library).

Here is a short guide to generating a User Library:

Open the menu entry Preferences -> Java -> Build Path -> User Libraries Press New..., enter a name (e.g. 'Guava') Press Add JARs... and search for the JAR files you downloaded (Unzip the Guava archive beforehand, inside you'll find the file guava-r07.jar. Select that in this dialog, preferably after moving it to a more desirable location) Now select Source Attachment -> Edit..., and find the path to the file guava-src-r07. If you want to, you can repeat this process for the JavaDoc location, pointing it to the javadoc folder from the guava distribution Press OK.

and some other suggestions are like

use Maven to import the libraries. It makes it simple to upgrade dependencies later and, once you install m2eclipse, Eclipse will pick the Guava libraries up for you. All you need in your Maven pom.xml to "use Guava" is something along the lines of the following in your dependencies section.

<dependency>
   <groupId>com.google.guava</groupId>
   <artifactId>guava</artifactId>
   <version>15.0</version>
 </dependency>

just go through the references also for more details

The very basics for using Guava

How to add Guava to Eclipse project

Adding Google Guava to Android project - significantly slows down the build

Community
  • 1
  • 1
Bharadwaja Bapatla
  • 3,281
  • 1
  • 12
  • 14
0

If you are using eclipse, just copy guava-07.jar into libs folder(create one if you don't have it).

Sudhanshu Mishra
  • 1,885
  • 1
  • 20
  • 38
0

Select the files in windows explorer and drag them to the libs folder in eclipse. This will also add them to the Android Private Libraries.

cartajs
  • 1
  • 1