Android握手失败

时间:2019-07-06 22:21:39

标签: android retrofit2

这是我的错误:

2019-07-07 01:05:09.211 23130-23177/com.example.try E/NativeCrypto: Unknown error during handshake

这是我的loginActivity:

call.enqueue(new Callback<LoginResponse>() {
        @Override
        public void onResponse(Call<LoginResponse> call, Response<LoginResponse> response) {
            LoginResponse loginResponse = response.body();

            if (!loginResponse.isError()) {//Login Success
                UserID = loginResponse.getUser().getUserID();
                UserName = loginResponse.getUser().getUserName();
                UserPassword = password;
                UserEmail = loginResponse.getUser().getUserEmail();

                Intent homeActivity = new Intent(getBaseContext(), HomeActivity.class);
                homeActivity.putExtra("UserName", UserName);
                homeActivity.putExtra("UserPassword", UserPassword);
                homeActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                startActivity(homeActivity);

            } else { //Loggin failed 
                String message = "";
                if (code == 100) { //password didnt match
                    Log.d(TAG, "onResponse(Else): " + loginResponse.getMessage());
                    message = "password didnt match";
                } else if (code == 200) {
                    message = loginResponse.getMessage();
                }
                Toast.makeText(LoginActivity.this, message, Toast.LENGTH_SHORT).show();
            }
        }

        @Override
        public void onFailure(Call<LoginResponse> call, Throwable t) {
            Toast.makeText(LoginActivity.this, t.getMessage(), Toast.LENGTH_LONG).show();
            Log.d(TAG, "onFailure: " + t.getMessage());
        }
    });

还有我的改造客户:

retrofit = new Retrofit.Builder()
            .baseUrl(BASE_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .build();

我尝试了this隔离,但是没有工作。因为我没有与 HttpsURLConnection 连接 非常感谢您的帮助。

0 个答案:

没有答案