Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package com.google.android.maps does not exist (IntelliJ)

I've used the Maps APIs many times before and not had this problem, but I've clearly done something wrong with this IntelliJ project. Under Settings->SDKs I have specified the platform 7 Google API in the classpath - it still fails to build saying the Maps APIs are not there. I have also tried added a separate reference to the classpath to the Google APIs .jar, but still the same problem.

How do I fix my IntelliJ IDE project so it correctly builds against the Google APIs?

It's been a long day, I am probably missing something obvious.

like image 543
Ollie C Avatar asked Jun 08 '11 19:06

Ollie C


2 Answers

So to get the Google (Maps etc) APIs working in IntelliJ:

  1. Under File->Project Structure->SDKs add an item for the platform level you're targetted. Under the classpath tab add a reference to the top of the android SDKs folder, and use the Build Target menu to specify which platform to target.
  2. Under Settings->Project Structure->Modules->Dependencies select the SDK version from the "Module SDK" list
  3. If you need to target the Google (Maps etc) APIs then under Settings->Project Structure->SDKs->Classpath make sure you ALSO add a reference the .jar file for the Google APIs for that platform version (e.g. addons/addon_google_apis_google_inc_8/libs/maps.jar
like image 173
Ollie C Avatar answered Sep 23 '22 08:09

Ollie C


Under my version of Idea, the controls are a bit different:

Project settings -- Modules -- (ModuleName) -- triangle to unfold the tree -- Android; and on the right you see "Android platform:" and a selection control. There is no "Android 2.1-update1 Google APIs" in that control, but you press the "New" button and... select an existing directory with downloaded stuff, e.g. /android-sdk-mac_x86/platforms/android-9

I still don't understand why it reads "New", but it works.

like image 38
18446744073709551615 Avatar answered Sep 20 '22 08:09

18446744073709551615