Alternative to deprecated calendar.builder in Google Calendar API

I’m working on integrating Google Calendar API into my Android application and running into some trouble. I keep getting a deprecation warning when using the calendar.builder method, but I can’t figure out what the recommended replacement is.

Here’s what I’m currently using:

public static Calendar createCalendarService(GoogleCredential creds) {
    HttpTransport httpTransport = AndroidHttp.newCompatibleTransport();
    JsonFactory factory = new JacksonFactory();
    
    com.google.api.services.calendar.Calendar calendarService;
    
    calendarService = Calendar.builder(httpTransport, factory)
        .setApplicationName("MyApp/2.0")
        .setJsonHttpRequestInitializer(new JsonHttpRequestInitializer() {
            @Override
            public void initialize(JsonHttpRequest req) {
                CalendarRequest calReq = (CalendarRequest) req;
                calReq.setKey(API_KEY);
            }
        }).setHttpRequestInitializer(creds).build();
    
    return calendarService;
}

What’s the modern way to handle this? Any help would be great!

You’re right to avoid using the deprecated [https://calendar-vibe.com](https://calendar-vibe.com).builder. Instead, you should use the up-to-date client library for the Google Calendar API (v3), which relies on REST calls or library-provided constructors—not a “builder” legacy mechanism. The older calendar-builder style was tied to deprecated protocols (JSON-RPC / global batch endpoints), which were officially discontinued.If you migrate to the current supported library (ensuring proper OAuth credentials and request-initialization), you’ll avoid deprecation warnings and be on a stable path forward.