We decided, perhaps naively, that we should update many of our libraries from two-year-old 1.12.0-betas to nice new versions 1.20.0. For example: we updated google-http-client-1.12.0-beta.jar to google-http-client-android-1.20.0.jar.
When we execute this code:
List<String> scopes = Lists.newArrayList(SendToGoogleUtils.FUSION_TABLES_SCOPE);
GoogleAccountCredential credential = SendToGoogleUtils.getGoogleAccountCredential(
context, account.name, scopes );
if (credential == null) {
return false;
}
Fusiontables fusiontables = new Fusiontables.Builder(
AndroidHttp.newCompatibleTransport(), new GsonFactory(), credential).build();
we get this amazing error report:
FATAL EXCEPTION Caused by: java.lang.NoSuchMethodError: No direct method <init>(Lcom/google/api/client/http/HttpTransport;Lcom/google/api/client/http/HttpRequestInitializer;Ljava/lang/String;Ljava/lang/String;Lcom/google/api/client/json/JsonObjectParser;Lcom/google/api/client/googleapis/services/GoogleClientRequestInitializer;Ljava/lang/String;Z)V in class Lcom/google/api/client/googleapis/services/json/AbstractGoogleJsonClient; or its super classes (declaration of 'com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient' appears in /data/app/dkr.ajijic.apps.tm-1/base.apk)
Does anybody know how to interpret it? We sure don't!
Had this on Android when the source code target version was higher than the OS version used on the device.
Therefore had access to methods that didn't exist in the library bundled with the OS, hence NoSuchMethodError
.
It just means that a constructor for AbstractGoogleJsonClient with a particular argument list wasn't available.
Check your super()
calls for your subclass(es) of AbstractGoogleJsonClient
and make sure you don't need to update the argument list to match your updated libraries.
If that's not in your source code, then there may be a library version dependency issue with Google API client library.
This issue is happened because of Proguard is applied via Proguard this class name and methods name changes that why NoSuchMethod exception is occurring.
To resolve this error please add below line into you Proguard rules.
-keep class com.google.** { *; }
Hopefully this will resolve your issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With