0

java lang NoClassDefFoundError com kinvey android Client Builder kinvey

收到以下错误消息 -

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

我的代码抛出错误是 -

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

添加了所有建议的 Kinvey 库 -

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

我的代码 -

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

公共类 MainActivity 扩展 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");
        }
    });


}

我得到的错误 -

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)

我的 kinvey.properties 文件 -

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

清单文件 -

<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,类在 Kinvey 中未找到异常,Clint.Builder()

4

1 回答 1

1

请确保所有 jar 包都包含在项目的 /libs/ 目录

在同一级别:

/src
/res
/libs -> copy jars here as well
于 2014-02-25T23:41:55.723 回答