问题
I am following Google Developer's Doc .I have included all mentioned jars but at runtime I getting this..
java.lang.RuntimeException: An error occured while executing doInBackground()
09-19 12:42:06.416: E/AndroidRuntime(14215): at android.os.AsyncTask$3.done(AsyncTask.java:300)
09-19 12:42:06.416: E/AndroidRuntime(14215): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
09-19 12:42:06.416: E/AndroidRuntime(14215): at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
09-19 12:42:06.416: E/AndroidRuntime(14215): at java.util.concurrent.FutureTask.run(FutureTask.java:242)
09-19 12:42:06.416: E/AndroidRuntime(14215): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
09-19 12:42:06.416: E/AndroidRuntime(14215): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
09-19 12:42:06.416: E/AndroidRuntime(14215): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
09-19 12:42:06.416: E/AndroidRuntime(14215): at java.lang.Thread.run(Thread.java:841)
09-19 12:42:06.416: E/AndroidRuntime(14215): Caused by: java.lang.NoClassDefFoundError: com.google.gson.stream.JsonReader
09-19 12:42:06.416: E/AndroidRuntime(14215): at com.google.api.client.json.gson.GsonFactory.createJsonParser(GsonFactory.java:86)
09-19 12:42:06.416: E/AndroidRuntime(14215): at com.google.api.client.json.gson.GsonFactory.createJsonParser(GsonFactory.java:76)
09-19 12:42:06.416: E/AndroidRuntime(14215): at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:85)
09-19 12:42:06.416: E/AndroidRuntime(14215): at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:81)
09-19 12:42:06.416: E/AndroidRuntime(14215): at com.google.api.client.http.HttpResponse.parseAs(HttpResponse.java:459)
09-19 12:42:06.416: E/AndroidRuntime(14215): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
09-19 12:42:06.416: E/AndroidRuntime(14215): at com.example.gmailquickstart.ApiAsyncTask.getDataFromApi(ApiAsyncTask.java:73)
09-19 12:42:06.416: E/AndroidRuntime(14215): at com.example.gmailquickstart.ApiAsyncTask.doInBackground(ApiAsyncTask.java:39)
09-19 12:42:06.416: E/AndroidRuntime(14215): at com.example.gmailquickstart.ApiAsyncTask.doInBackground(ApiAsyncTask.java:1)
09-19 12:42:06.416: E/AndroidRuntime(14215): at android.os.AsyncTask$2.call(AsyncTask.java:288)
09-19 12:42:06.416: E/AndroidRuntime(14215): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
The line where I am getting this error
ListLabelsResponse listResponse =
mActivity.mService.users().labels().list(user).execute();
来源:https://stackoverflow.com/questions/32665608/when-i-am-using-gmail-api-i-am-getting-java-lang-noclassdeffounderror-com-goog