首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >改造2搜索指定

改造2搜索指定
EN

Stack Overflow用户
提问于 2018-06-11 12:09:29
回答 1查看 125关注 0票数 0

我想调用GitHub API返回基于以下任意搜索参数的存储库列表:param

所以custom_search_param是在运行时声明的。

我做了这个界面:

代码语言:javascript
复制
public interface GitHubClient {

    String BASE_URL = "https://api.github.com/";

    @GET("search/repositories")
    Call<GitHubRepo> getReposForSearchParam (@Query("q") String custom_search_param);
}

我在MainActivity onCreate中这样称呼它:

代码语言:javascript
复制
Retrofit retrofit = new Retrofit.Builder().baseUrl(GitHubClient.BASE_URL).addConverterFactory(GsonConverterFactory.create()).build();
    GitHubClient gitHubClient = retrofit.create(GitHubClient.class);

    Call<GitHubRepo> call = gitHubClient.getReposForSearchParam("tetris");
    call.enqueue(new Callback<GitHubRepo>() {
        @Override
        public void onResponse(Call<GitHubRepo> call, Response<GitHubRepo> response) {
            Log.d("resp",response.toString());
            Log.d("respBody",response.body().toString());
        }

        @Override
        public void onFailure(Call<GitHubRepo> call, Throwable t) {
            Log.e("wentWrong", t.getMessage());
        }
    });

我总是收到onFailure的回应:

E/wentWrong: javax.net.ssl.SSLProtocolException: SSL握手中止: ssl=0xb8679dd0: SSL库失败,通常协议错误:1407742E:ssl routines:SSL23_GET_SERVER_HELLO:tlsv1警报协议版本(外部/openssl/ssl/s23_clnt.c:741 0x9db10901:0x000 ) 00000)

是否有人知道这里出了什么问题,以及是否应该以不同的方式声明GitHubClient接口指定?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-11 13:08:18

由于GitHub api已禁用TLSv1.1,您至少需要一个支持TLSv1.1的设备或客户机。因此,当android设备低于Android4.4时,它将无法工作。见这里

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50797404

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档