I\'m trying to get the sample code of Android \'Google Maps Android API v2\' working. I get the project built without errors. However, when I try to run the app on my Galaxy
I had the same issue, I did the following to fix the problem.
The order how they listed were first "src" and then "gen" path I switch them, so that "gen" folder is build before the "src"
THEN "Check" each one of the items listed
see: NoClassDefFoundError for code in an Java library on Android
This happens because of a lot of confusion over how to import projects. The docs https://developers.google.com/maps/documentation/android/intro#sample_code say you should not select "Copy projects into workspace" at any point and for getting the samples running this is what you need to stick to. Do not select this option for the play services and samples - leave them where they are.
After you import both check the following:
I had much the same problem. The file 'import-summary.txt' had the answer. In my case I had imported the eclipse project into a path with a space in the pathname. This causes a problem with the wizard. Created new path. Re-imported project. Then Build/Rebuild Project. No problems.
Try out the same sample code in the new workspace.
Even you can copy and paste the sample map project and google play services-lib project (/extras/google/google_play_services/libproject/google-play-services_lib,) and paste that in the new fresh workspace.
Follow next sample code instructions by google.
Skip on "4" section, and follow below instructions:
Copy google-play-services.jar form:
"android-sdk-folder\extras\google\google_play_services\libproject\google-play-services_lib\libs"
to "libs" folder --> right click on this jar in this folder --> Build path --> Add to build path.
Copy android-support-v4.jar form:
"android-sdk-folder\extras\android\support\v4"
to "libs" folder --> right click on this jar in this folder --> Build path --> Add to build path.
Where "android-sdk-folder" usually looks like: "C:\Users\User_Name\android-sdks"