在我的 Android 应用程序中使用 Factual API 时遇到问题。我想我已经添加了所有正确的 jar 文件。看看这里:
这是我的日志:
11-30 19:27:03.033: E/AndroidRuntime(4538): FATAL EXCEPTION: main
11-30 19:27:03.033: E/AndroidRuntime(4538): Process: com.example.foodsaver2, PID: 4538
11-30 19:27:03.033: E/AndroidRuntime(4538): java.lang.NoClassDefFoundError: com.factual.driver.Factual
11-30 19:27:03.033: E/AndroidRuntime(4538): at com.example.foodsaver2.DatabaseFiller.onCreate(DatabaseFiller.java:70)
11-30 19:27:03.033: E/AndroidRuntime(4538): at android.app.Activity.performCreate(Activity.java:5243)
11-30 19:27:03.033: E/AndroidRuntime(4538): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
11-30 19:27:03.033: E/AndroidRuntime(4538): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
11-30 19:27:03.033: E/AndroidRuntime(4538): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
11-30 19:27:03.033: E/AndroidRuntime(4538): at android.app.ActivityThread.access$700(ActivityThread.java:135)
11-30 19:27:03.033: E/AndroidRuntime(4538): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
11-30 19:27:03.033: E/AndroidRuntime(4538): at android.os.Handler.dispatchMessage(Handler.java:102)
11-30 19:27:03.033: E/AndroidRuntime(4538): at android.os.Looper.loop(Looper.java:137)
11-30 19:27:03.033: E/AndroidRuntime(4538): at android.app.ActivityThread.main(ActivityThread.java:4998)
11-30 19:27:03.033: E/AndroidRuntime(4538): at java.lang.reflect.Method.invokeNative(Native Method)
11-30 19:27:03.033: E/AndroidRuntime(4538): at java.lang.reflect.Method.invoke(Method.java:515)
11-30 19:27:03.033: E/AndroidRuntime(4538): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
11-30 19:27:03.033: E/AndroidRuntime(4538): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
11-30 19:27:03.033: E/AndroidRuntime(4538): at dalvik.system.NativeStart.main(Native Method)
这里有什么问题?我究竟做错了什么?顺便说一下,这是我的 AndroidManifest的一部分:
application android:label="@string/app_name">
<uses-library android:name="com.factual.driver.Factual" />
<activity android:name=".DatabaseFiller" android:label="@string/app_name">
从 DatabaseFiller 的第 70 行开始:
/*this is line 69, next line is 70*/ try {
Factual factual = new Factual("perosnal", "personal");
factual.fetch("products-cpg-nutrition",
new Query().search("028367831679"));
// row filter
Query q = new Query();
factual.fetch("products-cpg-nutrition",
q.or(q.field("upc").isEqual("028367831679"),
q.field("ean13").isEqual("028367831679")));
Toast.makeText(getApplicationContext(), (CharSequence) q, Toast.LENGTH_SHORT).show();
}
catch (Exception e) {
}
这里有什么问题?一段时间以来,我一直在用头撞墙。我已经检查过 SO 和 Google,但我无法将针固定在解决方案上。任何帮助是极大的赞赏。
编辑!Logcat 中还显示了另一条我忘记添加的消息:
11-30 20:44:09.993: E/dalvikvm(11654): Could not find class 'com.factual.driver.Factual', referenced from method com.example.foodsaver2.DatabaseFiller.onCreate
但我在我的 AndroidManifest 文件中有它。任何帮助,将不胜感激。