After deploying my GAE application to appspot, I keep getting the following error from an API request: NoSuchMethodError: com.google.common.hash.Hashing.crc32c()Lcom/google/common/hash/HashFunction;
I don't get any errors when running locally. The error is thrown when calling: com.google.cloud.storage.StorageOptions.getDefaultInstance().getService().create
I've tried Guava versions 18-20 and am running Java 7 with the following dependencies:
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.53'
compile 'com.google.appengine:appengine-endpoints:1.9.53'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.53'
compile 'com.google.appengine.tools:appengine-gcs-client:0.6'
compile 'com.google.api-client:google-api-client:1.22.0'
compile 'com.google.guava:guava:20.0'
compile 'com.google.cloud:google-cloud-storage:1.0.1'
compile 'com.googlecode.objectify:objectify:5.1.1'
compile 'javax.servlet:servlet-api:2.5'
compile 'org.jsoup:jsoup:1.10.2'
}
Thanks for the help!!
I did eventually figured this out...
I was using the Google Cloud Storage library (com.google.appengine.tools:appengine-gcs-client:0.6) which uses the guava-jdk5 library, which was conflicting with the version of Guava I was using; the HashFunction doesn't exist in the jdk5 version(s) of Guava.
The solution was to exclude guava-jdk5 from Google Cloud Storage library import. The relevant portion of my .gradle file looks like the following:
compile 'com.google.guava:guava:19.0'
compile ('com.google.appengine.tools:appengine-gcs-client:0.6') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
For others, it's possible that the conflict is being created by a different library so be sure to check the dependencies on your libraries to see if there's a conflict with the version of Guava you're trying to use.