Retrofit:SSLHandshakeException

0

I'm new for using retrofit library so I tried to apply one of online examples

after i run the code there is some error appear I tried to debug the app as well search about the problem but it did not helped me

the first error

E/RecyclerView: No adapter attached; skipping layout

the second error

E/MainActivity: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x7648aae8: Failure in SSL library, usually a protocol error error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version (external/openssl/ssl/s23_clnt.c:741 0x70d1fb86:0x00000000)

Here is the main activity code:

        public class MainActivity extends AppCompatActivity {
        private static final String TAG = MainActivity.class.getSimpleName();
       RecyclerView mRecyclerView;
        MyAdapter mAdapter;
        RecyclerView.LayoutManager mLayoutManager;



        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);

             mRecyclerView = (RecyclerView) findViewById(R.id.My_recycler_view);
            mLayoutManager = new LinearLayoutManager(this);
            mRecyclerView.setLayoutManager(mLayoutManager);
            /*to consume the REST web service. In Our MainActivity.Java, First, need to initialize the ApiClient*/
            GitHubClient client = ServiceGenerator.createService(GitHubClient.class);

            Call<List<GitHubRepo>> call = client.reposForUser("fs-opensource");
            // Fetch a list of the Github repositories.
        call.enqueue(new Callback<List<GitHubRepo>>() {

                @Override
                public void onResponse(Call<List<GitHubRepo>> call, Response<List<GitHubRepo>> response) {
                    int statusCode = response.code();
                    Log.d("TAG","statusCode = "+statusCode);
                    List<GitHubRepo> Reop = response.body();
                    mAdapter = new MyAdapter(Reop, R.layout.list_item, getApplicationContext());
                    mRecyclerView.setAdapter(mAdapter);
                    mAdapter.notifyDataSetChanged();


        }

                @Override
                public void onFailure(Call<List<GitHubRepo>> call, Throwable t) {

                    // Log error here since request failed
                    Log.e(TAG, t.toString());
                }
    });


 }
}

any help will be appropriated

android
retrofit2
asked on Stack Overflow Jul 7, 2018 by lobna

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0