以下のコードを使用して、Google カレンダーからアプリケーションにすべてのフィードを取得しています。
try{
URL feedUrl = new
URL("https://www.google.com/calendar/feeds/mymailID/public/full");
CalendarService myService = new CalendarService("exampleCo-exampleApp-1");
myService.setUserCredentials("mymailID", "mymailIDpassword");
// Send the request and receive the response:
CalendarEventFeed myFeed = myService.getFeed(feedUrl, CalendarEventFeed.class);
System.out.println("feed:"+myFeed);
}
catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
アプリケーションを実行すると、次のエラーが発生しました。ユーザー資格情報に問題があると思われるため、カレンダーを公開して実行しようとしましたが、同じエラーが発生しました。私はいくつかのソリューションを参照し、gdata jar ファイルを libs フォルダーに入れるようにアドバイスしましたが、これを行ったときに dalvik エラーが発生しました。これは、Android 4.0 では libs フォルダーに android-support-v4.jar が含まれており、これがエラーをポップアップするためです。ファイルの重複を言っています。
05-24 13:20:33.129: W/dalvikvm(274): Unable to resolve superclass of Lcom/google/gdata/client/calendar/CalendarService; (537)
05-24 13:20:33.129: W/dalvikvm(274): Link of class 'Lcom/google/gdata/client/calendar/CalendarService;' failed
05-24 13:20:33.139: E/dalvikvm(274): Could not find class 'com.google.gdata.client.calendar.CalendarService', referenced from method com.googlecalendar.googleapi.MainActivity.onCreate
05-24 13:20:33.139: W/dalvikvm(274): VFY: unable to resolve new-instance 546 (Lcom/google/gdata/client/calendar/CalendarService;) in Lcom/googlecalendar/googleapi/MainActivity;
05-24 13:20:33.139: D/dalvikvm(274): VFY: replacing opcode 0x22 at 0x000f
05-24 13:20:33.139: W/dalvikvm(274): VFY: unable to resolve exception class 717 (Lcom/google/gdata/util/ServiceException;)
05-24 13:20:33.139: W/dalvikvm(274): VFY: unable to find exception handler at addr 0x44
05-24 13:20:33.139: W/dalvikvm(274): VFY: rejected Lcom/googlecalendar/googleapi/MainActivity;.onCreate (Landroid/os/Bundle;)V
05-24 13:20:33.139: W/dalvikvm(274): VFY: rejecting opcode 0x0d at 0x0044
05-24 13:20:33.139: W/dalvikvm(274): VFY: rejected Lcom/googlecalendar/googleapi/MainActivity;.onCreate (Landroid/os/Bundle;)V
05-24 13:20:33.139: W/dalvikvm(274): Verifier rejected class Lcom/googlecalendar/googleapi/MainActivity;
05-24 13:20:33.139: W/dalvikvm(274): Class init failed in newInstance call (Lcom/googlecalendar/googleapi/MainActivity;)
05-24 13:20:33.139: D/AndroidRuntime(274): Shutting down VM
05-24 13:20:33.139: W/dalvikvm(274): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-24 13:20:33.169: E/AndroidRuntime(274): FATAL EXCEPTION: main
05-24 13:20:33.169: E/AndroidRuntime(274): java.lang.VerifyError: com.googlecalendar.googleapi.MainActivity
05-24 13:20:33.169: E/AndroidRuntime(274): at java.lang.Class.newInstanceImpl(Native Method)
05-24 13:20:33.169: E/AndroidRuntime(274): at java.lang.Class.newInstance(Class.java:1429)
05-24 13:20:33.169: E/AndroidRuntime(274): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-24 13:20:33.169: E/AndroidRuntime(274): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
05-24 13:20:33.169: E/AndroidRuntime(274): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-24 13:20:33.169: E/AndroidRuntime(274): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-24 13:20:33.169: E/AndroidRuntime(274): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-24 13:20:33.169: E/AndroidRuntime(274): at android.os.Handler.dispatchMessage(Handler.java:99)
05-24 13:20:33.169: E/AndroidRuntime(274): at android.os.Looper.loop(Looper.java:123)
05-24 13:20:33.169: E/AndroidRuntime(274): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-24 13:20:33.169: E/AndroidRuntime(274): at java.lang.reflect.Method.invokeNative(Native Method)
05-24 13:20:33.169: E/AndroidRuntime(274): at java.lang.reflect.Method.invoke(Method.java:521)
05-24 13:20:33.169: E/AndroidRuntime(274): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-24 13:20:33.169: E/AndroidRuntime(274): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-24 13:20:33.169: E/AndroidRuntime(274): at dalvik.system.NativeStart.main(Native Method)
05-24 13:20:36.480: I/Process(274): Sending signal. PID: 274 SIG: 9
05-24 13:25:02.579: W/dalvikvm(305): Unable to resolve superclass of Lcom/google/gdata/client/calendar/CalendarService; (537)
05-24 13:25:02.579: W/dalvikvm(305): Link of class 'Lcom/google/gdata/client/calendar/CalendarService;' failed
05-24 13:25:02.599: E/dalvikvm(305): Could not find class 'com.google.gdata.client.calendar.CalendarService', referenced from method com.googlecalendar.googleapi.MainActivity.onCreate
05-24 13:25:02.599: W/dalvikvm(305): VFY: unable to resolve new-instance 546 (Lcom/google/gdata/client/calendar/CalendarService;) in Lcom/googlecalendar/googleapi/MainActivity;
05-24 13:25:02.609: D/dalvikvm(305): VFY: replacing opcode 0x22 at 0x000f
05-24 13:25:02.639: W/dalvikvm(305): VFY: unable to resolve exception class 717 (Lcom/google/gdata/util/ServiceException;)
05-24 13:25:02.639: W/dalvikvm(305): VFY: unable to find exception handler at addr 0x44
05-24 13:25:02.649: W/dalvikvm(305): VFY: rejected Lcom/googlecalendar/googleapi/MainActivity;.onCreate (Landroid/os/Bundle;)V
05-24 13:25:02.649: W/dalvikvm(305): VFY: rejecting opcode 0x0d at 0x0044
05-24 13:25:02.649: W/dalvikvm(305): VFY: rejected Lcom/googlecalendar/googleapi/MainActivity;.onCreate (Landroid/os/Bundle;)V
05-24 13:25:02.649: W/dalvikvm(305): Verifier rejected class Lcom/googlecalendar/googleapi/MainActivity;
05-24 13:25:02.649: W/dalvikvm(305): Class init failed in newInstance call (Lcom/googlecalendar/googleapi/MainActivity;)
05-24 13:25:02.649: D/AndroidRuntime(305): Shutting down VM
05-24 13:25:02.649: W/dalvikvm(305): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-24 13:25:02.709: E/AndroidRuntime(305): FATAL EXCEPTION: main
05-24 13:25:02.709: E/AndroidRuntime(305): java.lang.VerifyError: com.googlecalendar.googleapi.MainActivity
05-24 13:25:02.709: E/AndroidRuntime(305): at java.lang.Class.newInstanceImpl(Native Method)
05-24 13:25:02.709: E/AndroidRuntime(305): at java.lang.Class.newInstance(Class.java:1429)
05-24 13:25:02.709: E/AndroidRuntime(305): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-24 13:25:02.709: E/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
05-24 13:25:02.709: E/AndroidRuntime(305): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-24 13:25:02.709: E/AndroidRuntime(305): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-24 13:25:02.709: E/AndroidRuntime(305): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-24 13:25:02.709: E/AndroidRuntime(305): at android.os.Handler.dispatchMessage(Handler.java:99)
05-24 13:25:02.709: E/AndroidRuntime(305): at android.os.Looper.loop(Looper.java:123)
05-24 13:25:02.709: E/AndroidRuntime(305): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-24 13:25:02.709: E/AndroidRuntime(305): at java.lang.reflect.Method.invokeNative(Native Method)
05-24 13:25:02.709: E/AndroidRuntime(305): at java.lang.reflect.Method.invoke(Method.java:521)
05-24 13:25:02.709: E/AndroidRuntime(305): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-24 13:25:02.709: E/AndroidRuntime(305): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-24 13:25:02.709: E/AndroidRuntime(305): at dalvik.system.NativeStart.main(Native Method)
05-24 13:25:05.190: I/Process(305): Sending signal. PID: 305 SIG: 9