[英]java.lang.NoClassDefFoundError: com.factual.driver.Factual
I have encountered a problem when using Factual API in my Android app. 在我的Android应用程序中使用Factual API时遇到问题。 I think I've added all the correct jar files.
我想我已经添加了所有正确的jar文件。 Take a look here:
在这里看看:
Here is my logcat: 这是我的日志:
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)
What's wrong here? 怎么了 What am I doing wrong?
我究竟做错了什么? And by the way, here is part of my AndroidManifest:
顺便说一下,这是我的AndroidManifest的一部分 :
application android:label="@string/app_name">
<uses-library android:name="com.factual.driver.Factual" />
<activity android:name=".DatabaseFiller" android:label="@string/app_name">
And from line 70 of DatabaseFiller: 从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) {
}
What's wrong here? 怎么了 I'm been banging my head on the wall for a while now.
我已经在墙上撞了一段时间。 I have checked SO and Google, but I can't pin the needle on the solution.
我已经检查了SO和Google,但无法将针扎在解决方案上。 Any help is greatly appreciated.
任何帮助是极大的赞赏。
EDIT! 编辑! Another message is also showing up in Logcat that I forgot to add:
我忘记添加的另一条消息也出现在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
But I have it in my AndroidManifest file. 但我的AndroidManifest文件中有它。 Any help would be appreciated.
任何帮助,将不胜感激。
Please do not treat this as an answer, rather as a comment. 请不要将此视为答案,而应视为评论。 I do not have privilege to comment yet.
我还没有发表评论的特权。 Please do not negate it as well.
请不要也否定它。
As of what I comprehend : 根据我的理解:
The line you mentioned, cannot be the location of error. 您提到的行不能是错误的位置。 Because if it would had encountered any issue in the try block, your code
(try and catch)
is swallowing the exception stopping it from throwing an exception
. 因为如果在try块中可能遇到任何问题,那么您的代码
(try and catch)
swallowing the exception stopping it from throwing an exception
。
This is possibly the wrong spot where you are searching for error. 这可能是您搜索错误的地方。
Moreover, if it is not able to recognize 'Factual'
in instance creation it would give a compilation error not a runtime exception. 此外,如果无法在实例创建中识别出
'Factual'
,它将给出编译错误,而不是运行时异常。
I would say figure out the exact location of the issue.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.