我想連接到谷歌日曆使用gdata API .. 我是新來的機器人,所以我認爲我正在提交一些mistkaes 我已經添加了3個外部jar到項目.. 日曆,客戶&核心..android gdata日曆不工作:(強制關閉
的apllication剛剛關閉.. :( 這裏是主要活動:
package caleda.qwe;
import java.net.URL;
import com.google.gdata.client.calendar.CalendarService;
import com.google.gdata.data.calendar.CalendarEntry;
import com.google.gdata.data.calendar.CalendarFeed;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
public class rrr extends Activity {
String res;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// new GetMostWanted().execute();
CalendarService myService = new CalendarService("calendar");
try{
myService.setUserCredentials("username", "password");
// Send the request and print the response
URL feedUrl = new URL("https://www.google.com/calendar/feeds/default/owncalendars/full");
CalendarFeed resultFeed = myService.getFeed(feedUrl, CalendarFeed.class);
// System.out.println("Calendars you own:");
// System.out.println();
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
CalendarEntry entry = resultFeed.getEntries().get(0);
// System.out.println("\t" + entry.getTitle().getPlainText());
res=entry.getTitle().getPlainText();
}
}
catch (Exception e) {
// TODO: handle exception
//System.out.println("not working");
res=e.toString();
}
// new DownloadFilesTask().execute();
TextView qw = (TextView) findViewById(R.id.TextView01);
qw.setText(res);
}
}
日誌貓顯示以下..
03-06 16:27:40.259: ERROR/dalvikvm(3252): Unable to open stack trace file '/data/anr/traces.txt': Permission denied 03-06 16:30:04.759: ERROR/AndroidRuntime(3316): ERROR: thread attach failed 03-06 16:30:06.910: ERROR/AndroidRuntime(3329): ERROR: thread attach failed 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): Uncaught handler: thread main exiting due to uncaught exception 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): java.lang.ExceptionInInitializerError 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at caleda.qwe.rrr.onCreate(rrr.java:25) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at android.app.ActivityThread.access$2200(ActivityThread.java:119) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at android.os.Handler.dispatchMessage(Handler.java:99) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at android.os.Looper.loop(Looper.java:123) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at android.app.ActivityThread.main(ActivityThread.java:4363) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at java.lang.reflect.Method.invokeNative(Native Method) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at java.lang.reflect.Method.invoke(Method.java:521) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at dalvik.system.NativeStart.main(Native Method) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): Caused by: java.lang.NoClassDefFoundError: com.google.common.collect.Maps 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at com.google.gdata.wireformats.AltRegistry.(AltRegistry.java:118) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at com.google.gdata.wireformats.AltRegistry.(AltRegistry.java:100) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): at com.google.gdata.client.Service.(Service.java:555) 03-06 16:30:06.910: ERROR/AndroidRuntime(3335): ... 14 more 03-06 16:30:06.910: ERROR/dalvikvm(3335): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
請幫我..
跟蹤指向你的班線25。那是哪條確切線? – 2011-03-06 12:32:30