Producteev4j 实施
大家好,stackoverflow.com 我是一名学生,正在为自己开发一个小型待办事项应用程序,与 Producteev 集成。现在我找到了一个名为 Producteev4j 的库,可以在以下位置找到:http://code.google.com/p /producteev4j/
我下载了该 jar 并将其添加到我的项目中。 但由于有多余的文档,我无法真正弄清楚如何实现它。我制作了一个带有以下代码摘录的按钮:
ProducteevTransport transport = new com.producteev4j.transport.SimpleTransportImpl();
((SimpleTransportImpl) transport).setApiKey("myapi");
((SimpleTransportImpl) transport).setApiSecret("mysecret");
if(service==null){
service = ProducteevServiceFactory.getService("com.producteev4j.services.version0.ProducteevServiceV0",transport);
}
try {
userLogin = service.userLogin(EMAIL, PASSWORD);
} catch (ProducteevSignatureException e) {
e.printStackTrace();
} catch (ProducteevServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ProducteevException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
userToken = userLogin.getToken();
和这些变量:
private ProducteevService service=null;
private UserLogin userLogin;
但这不起作用,我总是单击按钮应用程序崩溃并显示以下内容(这是一次运行的完整日志文件)
01-03 12:33:37.585: D/dalvikvm(244): GC freed 832 objects / 62864 bytes in 82ms
01-03 12:33:37.895: D/dalvikvm(244): GC freed 51 objects / 1936 bytes in 53ms
01-03 12:33:38.195: D/dalvikvm(244): GC freed 132 objects / 6240 bytes in 55ms
01-03 12:33:38.475: D/dalvikvm(244): GC freed 58 objects / 2312 bytes in 54ms
01-03 12:33:38.765: D/dalvikvm(244): GC freed 62 objects / 6112 bytes in 54ms
01-03 12:33:39.175: D/ViewFlipper(244): updateRunning() mVisible=true, mStarted=false, mUserPresent=true, mRunning=false
01-03 12:33:47.925: E/dalvikvm(244): Could not find class 'org.codehaus.jackson.map.ObjectMapper', referenced from method com.producteev4j.marshall.JacksonMappingUtil.<clinit>
01-03 12:33:47.925: W/dalvikvm(244): VFY: unable to resolve new-instance 146 (Lorg/codehaus/jackson/map/ObjectMapper;) in Lcom/producteev4j/marshall/JacksonMappingUtil;
01-03 12:33:47.925: D/dalvikvm(244): VFY: replacing opcode 0x22 at 0x0000
01-03 12:33:47.925: D/dalvikvm(244): Making a copy of Lcom/producteev4j/marshall/JacksonMappingUtil;.<clinit> code (32 bytes)
01-03 12:33:47.935: W/dalvikvm(244): VFY: unable to find class referenced in signature (Lorg/codehaus/jackson/type/JavaType;)
01-03 12:33:47.935: I/dalvikvm(244): Could not find method org.codehaus.jackson.map.ObjectMapper.canDeserialize, referenced from method com.producteev4j.marshall.JacksonMappingUtil.canRead
01-03 12:33:47.935: W/dalvikvm(244): VFY: unable to resolve virtual method 786: Lorg/codehaus/jackson/map/ObjectMapper;.canDeserialize (Lorg/codehaus/jackson/type/JavaType;)Z
01-03 12:33:47.935: D/dalvikvm(244): VFY: replacing opcode 0x6e at 0x0006
01-03 12:33:47.935: D/dalvikvm(244): Making a copy of Lcom/producteev4j/marshall/JacksonMappingUtil;.canRead code (40 bytes)
01-03 12:33:47.935: I/dalvikvm(244): Could not find method org.codehaus.jackson.map.type.TypeFactory.type, referenced from method com.producteev4j.marshall.JacksonMappingUtil.getJavaType
01-03 12:33:47.935: W/dalvikvm(244): VFY: unable to resolve static method 788: Lorg/codehaus/jackson/map/type/TypeFactory;.type (Ljava/lang/reflect/Type;)Lorg/codehaus/jackson/type/JavaType;
01-03 12:33:47.935: D/dalvikvm(244): VFY: replacing opcode 0x71 at 0x0000
01-03 12:33:47.935: D/dalvikvm(244): Making a copy of Lcom/producteev4j/marshall/JacksonMappingUtil;.getJavaType code (28 bytes)
01-03 12:33:47.945: W/dalvikvm(244): VFY: unable to find class referenced in signature (Lorg/codehaus/jackson/type/JavaType;)
01-03 12:33:47.945: I/dalvikvm(244): Could not find method org.codehaus.jackson.map.ObjectMapper.readValue, referenced from method com.producteev4j.marshall.JacksonMappingUtil.read
01-03 12:33:47.945: W/dalvikvm(244): VFY: unable to resolve virtual method 787: Lorg/codehaus/jackson/map/ObjectMapper;.readValue (Ljava/io/InputStream;Lorg/codehaus/jackson/type/JavaType;)Ljava/lang/Object;
01-03 12:33:47.945: D/dalvikvm(244): VFY: replacing opcode 0x6e at 0x000c
01-03 12:33:47.945: D/dalvikvm(244): Making a copy of Lcom/producteev4j/marshall/JacksonMappingUtil;.read code (282 bytes)
01-03 12:33:47.945: W/dalvikvm(244): VFY: unable to resolve exception class 140 (Lorg/codehaus/jackson/JsonParseException;)
01-03 12:33:47.945: W/dalvikvm(244): VFY: unable to find exception handler at addr 0x2e
01-03 12:33:47.955: W/dalvikvm(244): VFY: rejected Lcom/producteev4j/marshall/JacksonMappingUtil;.read (Ljava/io/InputStream;Ljava/lang/Class;)Ljava/lang/Object;
01-03 12:33:47.955: W/dalvikvm(244): VFY: rejecting opcode 0x0d at 0x002e
01-03 12:33:47.955: W/dalvikvm(244): VFY: rejected Lcom/producteev4j/marshall/JacksonMappingUtil;.read (Ljava/io/InputStream;Ljava/lang/Class;)Ljava/lang/Object;
01-03 12:33:47.955: W/dalvikvm(244): Verifier rejected class Lcom/producteev4j/marshall/JacksonMappingUtil;
01-03 12:33:47.955: D/AndroidRuntime(244): Shutting down VM
01-03 12:33:47.955: W/dalvikvm(244): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
01-03 12:33:47.955: E/AndroidRuntime(244): Uncaught handler: thread main exiting due to uncaught exception
01-03 12:33:47.975: E/AndroidRuntime(244): java.lang.VerifyError: com.producteev4j.marshall.JacksonMappingUtil
01-03 12:33:47.975: E/AndroidRuntime(244): at com.producteev4j.transport.SimpleTransportImpl._doGet(SimpleTransportImpl.java:29)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.producteev4j.transport.AbstractTransport.process(AbstractTransport.java:69)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.producteev4j.transport.AbstractTransport.process(AbstractTransport.java:52)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.producteev4j.services.version0.ProducteevUserServiceV0Impl.userLogin(ProducteevUserServiceV0Impl.java:123)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.producteev4j.services.version0.ProducteevServiceV0.userLogin(ProducteevServiceV0.java:85)
01-03 12:33:47.975: E/AndroidRuntime(244): at producteev.push.Producteev_pushActivity$2.onClick(Producteev_pushActivity.java:87)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.View.performClick(View.java:2364)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.View.onTouchEvent(View.java:4179)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.widget.TextView.onTouchEvent(TextView.java:6541)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.View.dispatchTouchEvent(View.java:3709)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.os.Handler.dispatchMessage(Handler.java:99)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.os.Looper.loop(Looper.java:123)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.app.ActivityThread.main(ActivityThread.java:4363)
01-03 12:33:47.975: E/AndroidRuntime(244): at java.lang.reflect.Method.invokeNative(Native Method)
01-03 12:33:47.975: E/AndroidRuntime(244): at java.lang.reflect.Method.invoke(Method.java:521)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
01-03 12:33:47.975: E/AndroidRuntime(244): at dalvik.system.NativeStart.main(Native Method)
01-03 12:33:47.985: I/dalvikvm(244): threadid=7: reacting to signal 3
01-03 12:33:48.006: I/dalvikvm(244): Wrote stack trace to '/data/anr/traces.txt'
如果有人可以的话那就太好了看看。 你的弗洛
hey guys here at stackoverflow.com I'm a student and developing a small todo app for myself with producteev integration. Now I found a Library called Producteev4j that can be found at: http://code.google.com/p/producteev4j/
I downloaded and added the jar to my project.
but because of the spare doc I can't relly figure out how to implement it. I made a button with the following excerpt of code:
ProducteevTransport transport = new com.producteev4j.transport.SimpleTransportImpl();
((SimpleTransportImpl) transport).setApiKey("myapi");
((SimpleTransportImpl) transport).setApiSecret("mysecret");
if(service==null){
service = ProducteevServiceFactory.getService("com.producteev4j.services.version0.ProducteevServiceV0",transport);
}
try {
userLogin = service.userLogin(EMAIL, PASSWORD);
} catch (ProducteevSignatureException e) {
e.printStackTrace();
} catch (ProducteevServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ProducteevException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
userToken = userLogin.getToken();
and these variables:
private ProducteevService service=null;
private UserLogin userLogin;
But that doesn't work, always I click the button the Application crashes with the following (this is the complete log file of one run)
01-03 12:33:37.585: D/dalvikvm(244): GC freed 832 objects / 62864 bytes in 82ms
01-03 12:33:37.895: D/dalvikvm(244): GC freed 51 objects / 1936 bytes in 53ms
01-03 12:33:38.195: D/dalvikvm(244): GC freed 132 objects / 6240 bytes in 55ms
01-03 12:33:38.475: D/dalvikvm(244): GC freed 58 objects / 2312 bytes in 54ms
01-03 12:33:38.765: D/dalvikvm(244): GC freed 62 objects / 6112 bytes in 54ms
01-03 12:33:39.175: D/ViewFlipper(244): updateRunning() mVisible=true, mStarted=false, mUserPresent=true, mRunning=false
01-03 12:33:47.925: E/dalvikvm(244): Could not find class 'org.codehaus.jackson.map.ObjectMapper', referenced from method com.producteev4j.marshall.JacksonMappingUtil.<clinit>
01-03 12:33:47.925: W/dalvikvm(244): VFY: unable to resolve new-instance 146 (Lorg/codehaus/jackson/map/ObjectMapper;) in Lcom/producteev4j/marshall/JacksonMappingUtil;
01-03 12:33:47.925: D/dalvikvm(244): VFY: replacing opcode 0x22 at 0x0000
01-03 12:33:47.925: D/dalvikvm(244): Making a copy of Lcom/producteev4j/marshall/JacksonMappingUtil;.<clinit> code (32 bytes)
01-03 12:33:47.935: W/dalvikvm(244): VFY: unable to find class referenced in signature (Lorg/codehaus/jackson/type/JavaType;)
01-03 12:33:47.935: I/dalvikvm(244): Could not find method org.codehaus.jackson.map.ObjectMapper.canDeserialize, referenced from method com.producteev4j.marshall.JacksonMappingUtil.canRead
01-03 12:33:47.935: W/dalvikvm(244): VFY: unable to resolve virtual method 786: Lorg/codehaus/jackson/map/ObjectMapper;.canDeserialize (Lorg/codehaus/jackson/type/JavaType;)Z
01-03 12:33:47.935: D/dalvikvm(244): VFY: replacing opcode 0x6e at 0x0006
01-03 12:33:47.935: D/dalvikvm(244): Making a copy of Lcom/producteev4j/marshall/JacksonMappingUtil;.canRead code (40 bytes)
01-03 12:33:47.935: I/dalvikvm(244): Could not find method org.codehaus.jackson.map.type.TypeFactory.type, referenced from method com.producteev4j.marshall.JacksonMappingUtil.getJavaType
01-03 12:33:47.935: W/dalvikvm(244): VFY: unable to resolve static method 788: Lorg/codehaus/jackson/map/type/TypeFactory;.type (Ljava/lang/reflect/Type;)Lorg/codehaus/jackson/type/JavaType;
01-03 12:33:47.935: D/dalvikvm(244): VFY: replacing opcode 0x71 at 0x0000
01-03 12:33:47.935: D/dalvikvm(244): Making a copy of Lcom/producteev4j/marshall/JacksonMappingUtil;.getJavaType code (28 bytes)
01-03 12:33:47.945: W/dalvikvm(244): VFY: unable to find class referenced in signature (Lorg/codehaus/jackson/type/JavaType;)
01-03 12:33:47.945: I/dalvikvm(244): Could not find method org.codehaus.jackson.map.ObjectMapper.readValue, referenced from method com.producteev4j.marshall.JacksonMappingUtil.read
01-03 12:33:47.945: W/dalvikvm(244): VFY: unable to resolve virtual method 787: Lorg/codehaus/jackson/map/ObjectMapper;.readValue (Ljava/io/InputStream;Lorg/codehaus/jackson/type/JavaType;)Ljava/lang/Object;
01-03 12:33:47.945: D/dalvikvm(244): VFY: replacing opcode 0x6e at 0x000c
01-03 12:33:47.945: D/dalvikvm(244): Making a copy of Lcom/producteev4j/marshall/JacksonMappingUtil;.read code (282 bytes)
01-03 12:33:47.945: W/dalvikvm(244): VFY: unable to resolve exception class 140 (Lorg/codehaus/jackson/JsonParseException;)
01-03 12:33:47.945: W/dalvikvm(244): VFY: unable to find exception handler at addr 0x2e
01-03 12:33:47.955: W/dalvikvm(244): VFY: rejected Lcom/producteev4j/marshall/JacksonMappingUtil;.read (Ljava/io/InputStream;Ljava/lang/Class;)Ljava/lang/Object;
01-03 12:33:47.955: W/dalvikvm(244): VFY: rejecting opcode 0x0d at 0x002e
01-03 12:33:47.955: W/dalvikvm(244): VFY: rejected Lcom/producteev4j/marshall/JacksonMappingUtil;.read (Ljava/io/InputStream;Ljava/lang/Class;)Ljava/lang/Object;
01-03 12:33:47.955: W/dalvikvm(244): Verifier rejected class Lcom/producteev4j/marshall/JacksonMappingUtil;
01-03 12:33:47.955: D/AndroidRuntime(244): Shutting down VM
01-03 12:33:47.955: W/dalvikvm(244): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
01-03 12:33:47.955: E/AndroidRuntime(244): Uncaught handler: thread main exiting due to uncaught exception
01-03 12:33:47.975: E/AndroidRuntime(244): java.lang.VerifyError: com.producteev4j.marshall.JacksonMappingUtil
01-03 12:33:47.975: E/AndroidRuntime(244): at com.producteev4j.transport.SimpleTransportImpl._doGet(SimpleTransportImpl.java:29)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.producteev4j.transport.AbstractTransport.process(AbstractTransport.java:69)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.producteev4j.transport.AbstractTransport.process(AbstractTransport.java:52)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.producteev4j.services.version0.ProducteevUserServiceV0Impl.userLogin(ProducteevUserServiceV0Impl.java:123)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.producteev4j.services.version0.ProducteevServiceV0.userLogin(ProducteevServiceV0.java:85)
01-03 12:33:47.975: E/AndroidRuntime(244): at producteev.push.Producteev_pushActivity$2.onClick(Producteev_pushActivity.java:87)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.View.performClick(View.java:2364)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.View.onTouchEvent(View.java:4179)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.widget.TextView.onTouchEvent(TextView.java:6541)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.View.dispatchTouchEvent(View.java:3709)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.os.Handler.dispatchMessage(Handler.java:99)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.os.Looper.loop(Looper.java:123)
01-03 12:33:47.975: E/AndroidRuntime(244): at android.app.ActivityThread.main(ActivityThread.java:4363)
01-03 12:33:47.975: E/AndroidRuntime(244): at java.lang.reflect.Method.invokeNative(Native Method)
01-03 12:33:47.975: E/AndroidRuntime(244): at java.lang.reflect.Method.invoke(Method.java:521)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
01-03 12:33:47.975: E/AndroidRuntime(244): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
01-03 12:33:47.975: E/AndroidRuntime(244): at dalvik.system.NativeStart.main(Native Method)
01-03 12:33:47.985: I/dalvikvm(244): threadid=7: reacting to signal 3
01-03 12:33:48.006: I/dalvikvm(244): Wrote stack trace to '/data/anr/traces.txt'
would be great if somebody could have a look at.
yours flo
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要添加 http://jackson.codehaus.org/ 库
使用映射器下载这个库 http://jackson.codehaus.org/1.9.3/jackson-all-1.9.3.jar
you need to add http://jackson.codehaus.org/ library
download this one with mapper http://jackson.codehaus.org/1.9.3/jackson-all-1.9.3.jar
我很抱歉缺乏文档(我没有太多空闲时间来做这件事)。
如前所述,您缺少该项目所具有的两个依赖项,即 jackson 库。
我已经更新了一些文档。
如果您有任何问题,请随时与我联系,请考虑项目页面上的问题。
该库的使用很简单,你有一个接口“ProducteevService”(在wiki中我告诉你如何配置它,有或没有spring),并且认为,你拥有(几乎所有)producteev api提供的服务。它返回一些类,这是带有响应数据的响应。
问候
胡安
I am sorry about the lack of documentation ( I didn´t have much spare time to do it ).
As already mentioned, you were missing the two dependencies that the project have, which are the jackson libraries.
I have updated the documentation a bit more.
If you have any problems do not hesitate to contact me thought the Issues at the project page.
The use of the library is simple, you have an interface "ProducteevService" (in the wiki I tell you how to configure it, with or without spring), and thought that , you have (almost all) the services provided by the producteev api. It returns some class, which is the response with the response data.
Regards
Juan