我正在尝试使用1.17-rc Google Calendar Java API创建一个简单的示例。Google Calendar 1.17带服务帐户的API - 未解决的GoogleClient类
HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
JsonFactory jsonFactory =JacksonFactory.getDefaultInstance()
String email = "[email protected]";
java.io.File licenseFile = new java.io.File("C:/Dev/apache-tomcat-6.0.37/app/webapps/12334b4c229abc2f7da1c3a9100d5d15c11d9874-privatekey.p12");
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.setServiceAccountId("[email protected]ccount.com")
.setServiceAccountUser(email)
.setServiceAccountScopes(new ArrayList<String>(){{add(CalendarScopes.CALENDAR);}})
.setServiceAccountPrivateKeyFromP12File(licenseFile)
.build();
com.google.api.services.calendar.Calendar client =
new com.google.api.services.calendar.Calendar.Builder(
httpTransport, jsonFactory, credential)
.setApplicationName("Google Calendar Sync").build();
Calendar calendar = client.calendars().get(email).execute();
我没有得到尽可能即使在运行这一点 - 它给我的投诉(在Eclipse)说:“该型com.google.api.client.googleapis.services.GoogleClient $ Builder无法得到解决它从所需的.class文件间接引用“。我已经安装了整个Google Calender API依赖ZIP,并将所有包含的JAR文件添加到我的类路径中。但确实看起来这个类不在其中 - 我在google-api-client-1.17.0-rc.jar中看到一个com.google.api.client.googleapis.services.AbstractGoogleClient,但是没有com在任何提供的JAR中使用.google.api.client.googleapis.services.GoogleClient。
我已经在这个两个不同的场合广泛搜索,我找不到任何其他人有这个问题,所以我想我必须做一些真正愚蠢的事情,我不能看到 - 如果有人可以告诉我什么,我会很感激...
没有人看到类似的问题? – user1116805
我有完全相同的问题。你有解决它吗? – user1930068