Android - Google Maps API v2 - NoClassDefFoundError Android - Google Maps API v2 - NoClassDefFoundError android android

Android - Google Maps API v2 - NoClassDefFoundError


I finally ran my application!

I didn't edit manifest, layout and activity, just updated project settings:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

I hope this will help someone.


1. Remove this permission from the manifest file:

<uses-library android:name="com.google.android.maps" />

it's part of Google Maps API V1 and not needed in Google Maps API V2.

2. Move the meta-data part to be right before the closing application tag:

<meta-data    android:name="com.google.android.maps.v2.API_KEY"    android:value="MY_KEY"/></application>

3. Regenerate a new key and register it via the Google API Console and make all the process again.


Follow these directions first

For the sake of completeness of documentation, download and get your keys and project setup.

Installing the Google Maps Android v2 API

The IntelliJ Specific Part

The Modules

  1. Import the google-play-services_lib as a module into the project.

    ${ANDROID_SDK_ROOT}/extras/google/google_play_services/libproject/google-play-services_lib

  2. Now make sure it is set as a Library module

    enter image description here

  3. Go into your project settings and make sure you add the module as a dependency. Take note of the folder icon.

    enter image description here

  4. Add the google-play-services.jar as a library to your module and one of the Android support modules if you plan to support older devices. Most people use android-support-v4.jar, but in my example I used android-support-v13.jar which includes everything in v4. This is where you get support for Fragment on older phones.