【问题标题】:android gdata calendar not working :( force closeandroid gdata日历不起作用:(强制关闭
【发布时间】:2011-03-06 11:20:02
【问题描述】:

我正在尝试使用 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: 错误/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):未捕获 处理程序:线程主退出由于 未捕获的异常 03-06 16:30:06.910: 错误/AndroidRuntime(3335): java.lang.ExceptionInInitializerError 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 caleda.qwe.rrr.onCreate(rrr.java:25) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 android.app.ActivityThread.access$2200(ActivityThread.java:119) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 android.os.Handler.dispatchMessage(Handler.java:99) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 android.os.Looper.loop(Looper.java:123) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 android.app.ActivityThread.main(ActivityThread.java:4363) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 java.lang.reflect.Method.invokeNative(Native 方法) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 java.lang.reflect.Method.invoke(Method.java:521) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 dalvik.system.NativeStart.main(Native 方法) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):由以下原因引起: java.lang.NoClassDefFoundError: com.google.common.collect.Maps 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 com.google.gdata.wireformats.AltRegistry.(AltRegistry.java:118) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 com.google.gdata.wireformats.AltRegistry.(AltRegistry.java:100) 03-06 16:30:06.910: 错误/AndroidRuntime(3335):在 com.google.gdata.client.Service.(Service.java:555) 03-06 16:30:06.910: 错误/AndroidRuntime(3335): ... 14 更多 03-06 16:30:06.910: 错误/dalvikvm(3335): 无法打开 堆栈跟踪文件 '/data/anr/traces.txt':权限 拒绝

请帮帮我..

【问题讨论】:

  • 跟踪指向您班级中的第 25 行。那是哪条线?

标签: android calendar gdata


【解决方案1】:

在我们的应用程序中包含两个外部 jar 文件。 这两个文件位于 gdata 的 deps 文件夹中

【讨论】:

  • 这是什么?哪两个jar文件?
猜你喜欢
  • 1970-01-01
  • 2015-02-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-08
  • 1970-01-01
  • 2015-01-14
相关资源
最近更新 更多