Google Contacts, Google Drive on Google App Engine

2019-09-16 13:43发布

问题:

using

gdata-contacts-3.0.jar, 
google-api-services-drive-v2-rev43-1.12.0-beta.jar,
guava-13.0.1.jar

Google Drive works but not Google Contacts. (i tried all kinds of solutions but never got both working together on Google App Engine where as it works in local devmode.)

calling: ContactsService gservice = new ContactsService("...");

Caused by: java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.copyOf([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet;

at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableTypes(AltFormat.java:399) at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableXmlTypes(AltFormat.java:387) at com.google.gdata.wireformats.AltFormat.(AltFormat.java:49) at com.google.gdata.client.Service.(Service.java:558)

回答1:

I had the same issue in my project, but it was solved when I used gdata 1.47.1. It can be found at http://code.google.com/p/gdata-java-client/downloads/detail?name=gdata-samples.java-1.47.1.zip

As I am using Maven, I uploaded it to my Nexus. Added dependency in pom.xml and it was started working.

One more thing to notice, I am using guava 13.0. If it helps you.



回答2:

OK now it works. Nobody was able to see that i used to

Add Google APIs from the Eclipse Plugin.

This does not only just add new jars that do not work in combination but also leaves all those old ones in a subfolder in my project ".google_apis...". Somehow those made it to Google App Engine and the odyssey started.

After removing those ... everything works fine. So again and, as everywhere mentioned, i was using a mixed guava version bulk which human nature does not expect to being activated.