Android Client for Endpoints无法识别Class

时间:2022-03-15 23:11:35

I generate a android client library for my Google Endpoint that looks like this:

我为我的Google Endpoint生成了一个Android客户端库,如下所示:

com.appspot.<my-app-id>.auth
|_ model
|_ Auth.java
|_ AuthRequest.java
|_ AuthRequestInitializer.java
|_ AuthScopes.java

But when I try to import the library I get a error:

但是当我尝试导入库时,我收到一个错误:

import com.appspot.<my-app-id>.auth.Auth; // 'Auth' red
import com.appspot.<my-app-id>.auth.model.AuthMessagesLoginResponseMessage; // 'AuthMessagesLoginResponseMessage' red

So I look in Auth.java file and found this error:

所以我查看Auth.java文件,发现此错误:

public class Check extends AuthRequest<com.appspot.<my-app-id>.auth.model.AuthMessagesCheckResponseMessage> {// 'AuthRequest' and 'AuthMesagesCheckResponseMessage' red

So I thought that the problem could be in AuthRequest.java and found this error:

所以我认为问题可能在AuthRequest.java中,并发现此错误:

 public AuthRequest(
  Auth client, String method, String uriTemplate, Object content, Class<T> responseClass) { // 'Auth' red

All this red only display the error message "cannot resolve symbol 'the-class-name' ".

所有这些红色只显示错误消息“无法解析符号'the-class-name'”。

What could be the problem?

可能是什么问题呢?

I'm using Android Studio 0.5.1, compileSdkVersion 19, buildToolsVersion 19.0.3.

我正在使用Android Studio 0.5.1,compileSdkVersion 19,buildToolsVersion 19.0.3。

2 个解决方案

#1


0  

I have found that the only way I can get endpoints to work is by copying the generated .java files.

我发现使端点工作的唯一方法是复制生成的.java文件。

#2


0  

I wasn't able to use the client library generated by endpoints as described on Google Developers site (i.e.: copying the library to the "libs" folder and then right click and "Add as a Library" in the Android Studio).

我无法使用Google开发人员网站上描述的端点生成的客户端库(即:将库复制到“libs”文件夹,然后右键单击并在Android Studio中“添加为库”)。

But it worked when I extract the .java files from the .jar android client library to the src > main > java folder of my project.

但是当我从.jar android客户端库中将.java文件解压缩到我项目的src> main> java文件夹时,它就起作用了。

#1


0  

I have found that the only way I can get endpoints to work is by copying the generated .java files.

我发现使端点工作的唯一方法是复制生成的.java文件。

#2


0  

I wasn't able to use the client library generated by endpoints as described on Google Developers site (i.e.: copying the library to the "libs" folder and then right click and "Add as a Library" in the Android Studio).

我无法使用Google开发人员网站上描述的端点生成的客户端库(即:将库复制到“libs”文件夹,然后右键单击并在Android Studio中“添加为库”)。

But it worked when I extract the .java files from the .jar android client library to the src > main > java folder of my project.

但是当我从.jar android客户端库中将.java文件解压缩到我项目的src> main> java文件夹时,它就起作用了。