Select Run > Run to test the PlusSampleActivity
sample app. Choose Android application if prompted. The sample application will launch on your device.
When I launched the app from Eclipse I kept getting a crash. My LogCat looked like this:I/dalvikvm(9444): Failed resolving Lcom/google/android/gms/samples/plus/PlusOneActivity; interface 556 'Lcom/google/android/gms/common/GooglePlayServicesClient$ConnectionCallbacks;'W/dalvikvm(9444): Link of class 'Lcom/google/android/gms/samples/plus/PlusOneActivity;' failed E/dalvikvm(9444): Could not find class 'com.google.android.gms.samples.plus.PlusOneActivity', referenced from method com.google.android.gms.samples.plus.PlusSampleActivity.<clinit>
W/dalvikvm(9444): VFY: unable to resolve const-class 590 (Lcom/google/android/gms/samples/plus/PlusOneActivity;) in Lcom/google/android/gms/samples/plus/PlusSampleActivity;
D/dalvikvm(9444): VFY: replacing opcode 0x1c at 0x0018
W/dalvikvm(9444): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/google/android/gms/samples/plus/PlusSampleActivity;
W/dalvikvm(9444): Class init failed in newInstance call (Lcom/google/android/gms/samples/plus/PlusSampleActivity;)
D/AndroidRuntime(9444): Shutting down VM
W/dalvikvm(9444): threadid=1: thread exiting with uncaught exception (group=0x4203e2a0)
E/AndroidRuntime(9444): FATAL EXCEPTION: main
E/AndroidRuntime(9444): java.lang.ExceptionInInitializerErrorE/AndroidRuntime(9444): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime(9444): at java.lang.Class.newInstance(Class.java:1319)
E/AndroidRuntime(9444): at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
E/AndroidRuntime(9444): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2025)
E/AndroidRuntime(9444): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
E/AndroidRuntime(9444): at android.app.ActivityThread.access$700(ActivityThread.java:140)
E/AndroidRuntime(9444): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
E/AndroidRuntime(9444): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(9444): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(9444): at android.app.ActivityThread.main(ActivityThread.java:4921)
E/AndroidRuntime(9444): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(9444): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(9444): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
E/AndroidRuntime(9444): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
E/AndroidRuntime(9444): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(9444): Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.samples.plus.PlusOneActivity
E/AndroidRuntime(9444): at com.google.android.gms.samples.plus.PlusSampleActivity.<clinit>(PlusSampleActivity.java:46)
E/AndroidRuntime(9444): ... 15 more
I/Process(9444): Sending signal. PID: 9444 SIG: 9
After some googling around I stumbled upon this solution on StackOverflow: http://stackoverflow.com/questions/2247998/noclassdeffounderror-eclipse-and-android/9916751#9916751
E/AndroidRuntime(9444): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2025)
E/AndroidRuntime(9444): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
E/AndroidRuntime(9444): at android.app.ActivityThread.access$700(ActivityThread.java:140)
E/AndroidRuntime(9444): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
E/AndroidRuntime(9444): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(9444): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(9444): at android.app.ActivityThread.main(ActivityThread.java:4921)
E/AndroidRuntime(9444): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(9444): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(9444): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
E/AndroidRuntime(9444): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
E/AndroidRuntime(9444): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(9444): Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.samples.plus.PlusOneActivity
E/AndroidRuntime(9444): at com.google.android.gms.samples.plus.PlusSampleActivity.<clinit>(PlusSampleActivity.java:46)
E/AndroidRuntime(9444): ... 15 more
I/Process(9444): Sending signal. PID: 9444 SIG: 9
After some googling around I stumbled upon this solution on StackOverflow: http://stackoverflow.com/questions/2247998/noclassdeffounderror-eclipse-and-android/9916751#9916751
It pretty much explains that the way external libraries has to be included in an Eclipse project have changed. The Google Play Services library was included in the project properties under Android > Library.
Reference: ..\..\libproject\google-play-services_lib
Project: google-play-services_lib
Remove this reference and instead add it in the project properties under Java Build Path > Libraries tab. Click "Add External JARs..." and browse to <android-sdk-folder>\extras\google\google_play_services\libproject\google-play-services_lib\libs. Select "google-play-services.jar". Now go to the Order and Export tab and select "google-play-services.jar".
Now the Google+ SDK Sample app runs and works!