在这里,我正在使用名为 3rd 的 sdk 做一些事情,parse sdk
它为 Android 平台提供了一些 api。
我浏览了这个链接并尝试为这个解析 sdk 做一些示例工作。
但是在完成了该链接上提到的所有 stpes 之后,我无法运行这个测试 android 应用程序。
我在 logcat 中收到以下错误。
我已经在项目根目录中创建的 libs 文件夹中导入了 .jar 文件。
代码:
package com.parse.starter;
import com.parse.Parse;
import com.parse.ParseObject;
import android.app.Activity;
import android.os.Bundle;
public class ParseStarterProjectActivity extends Activity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Parse.initialize(this, "ZVhSPsDKds8cerZ2jjDNXCpu332RHtix6Gp7YkDa", "poQXYifVzMd6haf56U5FQ13xeCxecdGippZeCMyVO");
ParseObject testObject = new ParseObject("TestObject");
testObject.put("foo", "bar");
testObject.saveInBackground();
setContentView(R.layout.main);
}
}
错误日志:
05-27 17:16:47.200: W/dalvikvm(468): threadid=1: thread exiting with uncaught exception (group=0x40015560)
05-27 17:16:47.210: E/AndroidRuntime(468): FATAL EXCEPTION: main
05-27 17:16:47.210: E/AndroidRuntime(468): java.lang.NoClassDefFoundError: com.parse.ParseObject
05-27 17:16:47.210: E/AndroidRuntime(468): at com.parse.starter.ParseStarterProjectActivity.onCreate(ParseStarterProjectActivity.java:14)
05-27 17:16:47.210: E/AndroidRuntime(468): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-27 17:16:47.210: E/AndroidRuntime(468): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
05-27 17:16:47.210: E/AndroidRuntime(468): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
05-27 17:16:47.210: E/AndroidRuntime(468): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-27 17:16:47.210: E/AndroidRuntime(468): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
05-27 17:16:47.210: E/AndroidRuntime(468): at android.os.Handler.dispatchMessage(Handler.java:99)
05-27 17:16:47.210: E/AndroidRuntime(468): at android.os.Looper.loop(Looper.java:123)
05-27 17:16:47.210: E/AndroidRuntime(468): at android.app.ActivityThread.main(ActivityThread.java:3683)
05-27 17:16:47.210: E/AndroidRuntime(468): at java.lang.reflect.Method.invokeNative(Native Method)
05-27 17:16:47.210: E/AndroidRuntime(468): at java.lang.reflect.Method.invoke(Method.java:507)
05-27 17:16:47.210: E/AndroidRuntime(468): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-27 17:16:47.210: E/AndroidRuntime(468): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-27 17:16:47.210: E/AndroidRuntime(468): at dalvik.system.NativeStart.main(Native Method)
编辑 :
根据choop评论。
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="lib" path="libs/Parse-1.0.19.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>