我正在尝试使用gdata api连接到谷歌日历。 我是android的新手,所以我想我会犯一些错误。 我已经为项目添加了3个外部jar .. 日历,客户&核心......
应用程序刚关闭.. :( 这是主要活动:
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);
}
}
log cat显示以下内容..
03-06 16:27:40.259: ERROR / dalvikvm(3252):无法打开 堆栈跟踪文件 '/data/anr/traces.txt':权限 否认03-06 16:30:04.759: 错误/ AndroidRuntime(3316):错误: 线程附加失败03-06 16:30:06.910: 错误/ AndroidRuntime(3329):错误: 线程附加失败03-06 16:30:06.910: 错误/ AndroidRuntime(3335):未捕获 handler:thread main由于退出 未被捕的例外03-06 16:30:06.910: ERROR / AndroidRuntime(3335): java.lang.ExceptionInInitializerError 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at caleda.qwe.rrr.onCreate(rrr.java:25) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at android.app.ActivityThread.access $ 2200(ActivityThread.java:119) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1863) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at android.os.Handler.dispatchMessage(Handler.java:99) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at android.os.Looper.loop(Looper.java:123) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at android.app.ActivityThread.main(ActivityThread.java:4363) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at java.lang.reflect.Method.invokeNative(母语 方法)03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at java.lang.reflect.Method.invoke(Method.java:521) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:860) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at dalvik.system.NativeStart.main(母语 方法)03-06 16:30:06.910: 错误/ AndroidRuntime(3335):引起: java.lang.NoClassDefFoundError: com.google.common.collect.Maps 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at com.google.gdata.wireformats.AltRegistry。(AltRegistry.java:118) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at com.google.gdata.wireformats.AltRegistry。(AltRegistry.java:100) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):at com.google.gdata.client.Service。(Service.java:555) 03-06 16:30:06.910: 错误/ AndroidRuntime(3335):... 14 更多03-06 16:30:06.910: ERROR / dalvikvm(3335):无法打开 堆栈跟踪文件 '/data/anr/traces.txt':权限 拒绝
请帮帮我..
答案 0 :(得分:0)
在我们的应用程序中包含两个外部jar文件。 这两个文件在gdata
的deps文件夹中可用