0

java lang NoClassDefFoundError com kinvey android Client Builder kinvey

getting below error message -

02-13 14:30:31.554: E/AndroidRuntime(787): java.lang.NoClassDefFoundError: com.kinvey.android.Client$Builder

my code throwing error is -

 final Client mKinveyClient = new Client.Builder(this.getApplicationContext()).build();

Added all suggested Kinvey library -

D:\Software\kinvey-2.6.14\libs\google-http-client-1.16.0-rc.jar
D:\Software\kinvey-2.6.14\libs\google-http-client-android-1.16.0-rc.jar
D:\Software\kinvey-2.6.14\libs\google-http-client-gson-1.16.0-rc.jar
D:\Software\kinvey-2.6.14\libs\gson-2.1.jar
D:\Software\kinvey-2.6.14\libs\guava-14.0.1.jar
D:\Software\kinvey-2.6.14\libs\kinvey-android-lib-2.6.14.jar
D:\Software\kinvey-2.6.14\libs\kinvey-java-2.6.14.jar

My code -

import com.kinvey.android.Client;
import com.kinvey.android.callback.KinveyPingCallback;

public class MainActivity extends Activity {

protected static final String TAG = "Kinvey Testing ";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

   final Client mKinveyClient = new Client.Builder(this.getApplicationContext()).build();


    mKinveyClient.ping(new KinveyPingCallback() 
    {
      public void onFailure(Throwable t) {
            Log.e(TAG, "Kinvey Ping Failed", t);
      }
       public void onSuccess(Boolean b) {
           Log.d(TAG, "Kinvey Ping Success");
        }
    });


}

Error I'm getting -

02-14 06:26:02.630: E/AndroidRuntime(2083): Process: com.example.kinveyhw, PID: 2083
02-14 06:26:02.630: E/AndroidRuntime(2083): java.lang.NoClassDefFoundError:     com.kinvey.android.Client$Builder
02-14 06:26:02.630: E/AndroidRuntime(2083):     at com.example.kinveyhw.MainActivity.onCreate(MainActivity.java:26)
02-14 06:26:02.630: E/AndroidRuntime(2083):     at android.app.Activity.performCreate(Activity.java:5243)
02-14 06:26:02.630: E/AndroidRuntime(2083):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
02-14 06:26:02.630: E/AndroidRuntime(2083):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
02-14 06:26:02.630: E/AndroidRuntime(2083):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
02-14 06:26:02.630: E/AndroidRuntime(2083):     at android.app.ActivityThread.access$700(ActivityThread.java:135)
02-14 06:26:02.630: E/AndroidRuntime(2083):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
02-14 06:26:02.630: E/AndroidRuntime(2083):     at android.os.Handler.dispatchMessage(Handler.java:102)
02-14 06:26:02.630: E/AndroidRuntime(2083):     at android.os.Looper.loop(Looper.java:137)
02-14 06:26:02.630: E/AndroidRuntime(2083):     at android.app.ActivityThread.main(ActivityThread.java:4998)
02-14 06:26:02.630: E/AndroidRuntime(2083):     at java.lang.reflect.Method.invokeNative(Native Method)
02-14 06:26:02.630: E/AndroidRuntime(2083):     at java.lang.reflect.Method.invoke(Method.java:515)
02-14 06:26:02.630: E/AndroidRuntime(2083):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
02-14 06:26:02.630: E/AndroidRuntime(2083):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)

02-14 06:26:02.630: E/AndroidRuntime(2083): at dalvik.system.NativeStart.main(Native Method)

My kinvey.properties file -

app.key=kid_ee-WQHov89
app.secret=566ed27ffdc74ae78ada0c3ef031cc95

Manifest file -

<uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="17" />

<uses-permission android:name="android.permission.INTERNET" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.kinveyhw.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

Kinvey, Android, NoClassDefFoundError, Class Not found exception in Kinvey, Clint.Builder()

Rakesh
  • 2,732
  • 29
  • 28
  • It didn't find any class named **Client.Builder** under the package **com.kinvey.android**. So, look at your class name and package carefully again. – Hamid Shatu Feb 13 '14 at 11:08
  • May be there is some version change for your kinvey jar. Check that – Android Feb 13 '14 at 11:13
  • I'm following URL - http://devcenter.kinvey.com/android/guides/getting-started# .. mentioned the same process, I'm doing. – Rakesh Feb 13 '14 at 11:55
  • @Hamid Shatu, Yes, in package Client class is available and Builder as interface available. Black Devil, I'm using latest jar D:\Software\kinvey-2.6.14\libs\kinvey-android-lib-2.6.14.jar D:\Software\kinvey-2.6.14\libs\kinvey-java-2.6.14.jar Please let me know, still i'm searching solution, I've have app_key and app_secret. – Rakesh Feb 14 '14 at 11:32

1 Answers1

1

Please ensure all the jars are included in the /libs/ directory within your project.

at the same level:

/src
/res
/libs -> copy jars here as well
edthethird
  • 6,263
  • 2
  • 24
  • 34