java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable in android

See the answer here:
Google Maps Android API v2 – Sample Code crashes
While the question lists a different exception, the answer specifically mentions your exact problem.

Specifically, it’s important to import google-play-services_lib as a project:
Select File > Import > Android > Existing Android Code Into Workspace and click Next.
Select Browse…, enter [android-sdk-folder]/extras/google/google_play_services/libproject/google-play-services_lib, and click Finish.
(See https://developers.google.com/maps/documentation/android/intro under “Sample Code”)
Then follow the instructions from the linked answer:

  • Import the actual source for the “google-play-services_lib” project and link it as an >Android library.
    • Do this through Project -> Properties -> Android -> Library, Add -> google-play-services_lib (you can right click on your project and choose Properties, then select Android).
    • Do not add it as a dependent Project through the “Java Build Path” for your project, that didn’t work for me.

Leave a Comment