Google Platform for Android - NoClassDefFoundError: com.google.android.gms.samples.plus.SignInActivity

I want to run a google +: PlusSampleActivity sample.

The steps for this are defined here: https://developers.google.com/+/mobile/android/getting-started

  • Download Google Play services for my eclipse;
  • In the Google APIs console, create an API project
  • In the Services panel, enable the Google+ API

    • In the Access API panel, create an OAuth 2.0 client identifier
    • set product name
    • select android
    • install packagename as: com.google.android.gms.samples.plus
    • generate a signature certificate fingerprint using keytool
    • Create customer id
  • Import the sample as described on page

The project has no compile-time errors.

But if I run the application, I get an exception:

FATAL EXCEPTION: main java.lang.ExceptionInInitializerError at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1409) at android.app.Instrumentation.newActivity(Instrumentation.java:1021) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675) at android.app.ActivityThread.access$1500(ActivityThread.java:121) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3701) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NoClassDefFoundError: 

I don’t know what is wrong when I tried to run a simpler application. Step 3 Initialize PlusClient, a similar exception:

 Caused by: java.lang.NoClassDefFoundError: com.example.ExampleActivity... 

Of course, I added access to the application by adding a new client identifier.

Link added to library correctly

I solved my problem:

Right-click the project, select Android Tools β†’ Add Support Library

A source on how to do this.

+7
source share
4 answers

Try running Project β†’ Clean to fix the problem. It seemed to work for one person.

The library refers automatically to the project, but perhaps Eclipse forgets this and needs to be reminded.

0
source

The correct answer, as indicated by user 1861240, is this: Right-click on your project, select "Android Tools"> "Add Support Library" ...

This seems to be installing the latest support library for you.

0
source

I have the same error, but support library support has been added for me. I also tried Project-> Clean and restarted Eclipse. This ultimately worked after I changed the target API to 4.4.

0
source

Just follow the directions here. Keep in mind to keep track of the project, and not to ignore any step.

0
source

All Articles