Search code examples
androidcalendargdata

android gdata calendar not working :( force close


I am trying to connect to google calendar using gdata api.. I am new to android so I think I am commiting some mistkaes. I have added 3 external jar to the projects.. calendar,client & core ..

The apllication just closes .. :( here is main activity :

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 shows the following..

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

Please help me out..


Solution

  • include two external jar files in our application.. Those two files are available in deps folder of gdata