从android调用端点时的java.lang.VerifyError

时间:2013-04-03 18:32:19

标签: java android google-app-engine google-cloud-endpoints google-eclipse-plugin

我有一个app-engine连接Android应用程序。服务器在java中。我正在测试后端的登录Web服务。代码调用端点发送登录信息的地方,我得到一个例外。我包括整个堆栈跟踪。但根本原因似乎是LoginActivity.java:262

service.registerUser(request).execute();//service is endpoint

此登录没有什么特别之处。它只是一个带数据的POST。我不知道如何解释错误行

Caused by: java.lang.VerifyError: com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler

我认为这是我需要理解的。

无论如何,这是完整的痕迹:

04-03 11:48:50.028: E/AndroidRuntime(9385): FATAL EXCEPTION: AsyncTask #1
04-03 11:48:50.028: E/AndroidRuntime(9385): java.lang.RuntimeException: An error occured while executing doInBackground()
04-03 11:48:50.028: E/AndroidRuntime(9385):     at android.os.AsyncTask$3.done(AsyncTask.java:200)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at java.lang.Thread.run(Thread.java:1096)
04-03 11:48:50.028: E/AndroidRuntime(9385): Caused by: java.lang.VerifyError: com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler
04-03 11:48:50.028: E/AndroidRuntime(9385):     at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.initialize(GoogleAccountCredential.java:124)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at com.google.api.client.http.HttpRequestFactory.buildRequest(HttpRequestFactory.java:93)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:292)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:412)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:345)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:463)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at com.example.learning.LoginActivity$UserLoginTask.doInBackground(LoginActivity.java:262)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at com.example.learning.LoginActivity$UserLoginTask.doInBackground(LoginActivity.java:1)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
04-03 11:48:50.028: E/AndroidRuntime(9385):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
04-03 11:48:50.028: E/AndroidRuntime(9385):     ... 4 more
04-03 11:48:50.160: W/IInputConnectionWrapper(9385): showStatusIcon on inactive InputConnection

编辑:

要设置凭据,我只需按照模板进行操作:

public static GameApp getService(Context context) {
        GoogleAccountCredential credential = GoogleAccountCredential.usingAudience(context, StateValues.AUDIENCE);
        GameApp.Builder builder = new GameApp.Builder(
            AndroidHttp.newCompatibleTransport(),
            new GsonFactory(),
            credential);
        GameApp service = builder.build();
        return service;
    }

1 个答案:

答案 0 :(得分:2)

看起来问题是google-play-service.jar。我一直在通过构建路径添加它。现在我手动将它添加到libs文件夹中,这个问题就消失了。谢谢大家的评论。向所有人推荐。