3

I am having issues importing com.google.* libraries.

I am very new to eclipse and do not know how to import these libraries to fix my code errors. Can someone point me in the right direction to importing these libraries?

Raedwald
  • 40,290
  • 35
  • 127
  • 207
gh9
  • 8,245
  • 8
  • 53
  • 89

3 Answers3

3

Import Google libraries the same way you do any others, with the Java import statement. Or in Eclipse, add them to the project build path.

This assumes, of course, you HAVE the Google libraries. If you're asking how to import than from a remote location (e.g., a Google server) that can't be done. You'll need to download them first to your project directory & go from there.

aksarben
  • 350
  • 1
  • 4
  • I have used the sdk to download the google libraries and am importing them one at a time.
    import com.google.androidmaps.mapview;
    but i am still getting the same errors
    – gh9 Nov 30 '10 at 20:46
2

The following line:

import com.google.*;

should do just fine. However, keep this in mind,

  • Doing import com.google.* does not import for instance import com.google.appengine.*

  • You need to have com.google.* on your class path. (Right click on the project and select "Configure class path" to add possibly missing jars / libraries.)

aioobe
  • 383,660
  • 99
  • 774
  • 796
0

Another tip: Many (including myself) recommend not using the wildcard asterisk in import statements. Reason: It includes all classes in a package, which can cause unexpected (& hard to debug) behavior if different packages have classes with the same name.

If you don't use the wild card, then you can see exactly what's being imported & in what order.

aksarben
  • 350
  • 1
  • 4