使用Flex移动应用程序使用Raturofit



我正在为带有本机扩展的Android的Flex移动应用程序。我正在尝试在Java代码中使用Raturofit,但是Raturofit调用失败。

我有以下接口定义:

public interface GitHubService {
@GET("/repos/{owner}/{repo}/contributors")
  List<Contributor> contributors(
      @Path("owner") String owner,
      @Path("repo") String repo
  );
}

然后,我从Java代码中的适当点调用了AsyncTask。它的doInBackground方法看起来像这样:

    @Override
protected String doInBackground(String... arg0) {
    Gson gson = new GsonBuilder()
    .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
    .registerTypeAdapter(Date.class, new DateTypeAdapter())
    .create();
    RestAdapter restAdapter = new RestAdapter.Builder().setServer("https://api.github.com")
    .setConverter(new GsonConverter(gson))
    .build();
    GitHubService service = restAdapter.create(GitHubService.class);
    List<Contributor> contributors = service.contributors("square", "okhttp");
    for (Contributor contributor : contributors) {
      Log.d("FooTask", contributor.login + " - " + contributor.contributions);
    }
    return null;
}

从这一切中,我希望看到logcat中打印的列表;相反,我得到以下异常:

FATAL EXCEPTION: AsyncTask #1
java.lang.RuntimeException: An error occured while executing doInBackground()
...
Caused by: java.lang.IllegalStateException: No Retrofit annotation found on parameter 1 of contributors

有没有一种方法可以使改造在本机扩展中使用Flex移动?

目前不可能。ADT在其汇编过程中的Java类中的所有注释。

最新更新