凌空图书馆引起了异常

时间:2017-10-10 10:32:13

标签: android android-volley

我用过volley来调用api,所以我使用的版本是“编译'com.mcxiaoke.volley:library-aar:1.0.0'”但今天几乎在5个月之后似乎我在另一台笔记本电脑中导入项目工作后出现了一些错误,因此运行后出现错误

  

W / System.err:删除失败:ENOENT(没有这样的文件或目录):   /data/user/0/in.medma.callbin/files/.Fabric/com.crashlytics.sdk.android.crashlytics-core/log-files/crashlytics-userlog-59DC9B9B0184-0001-3355-3FD34D64056C.temp

     

E / UncaughtException:java.lang.NullPointerException:尝试调用   null对象上的虚方法'int java.lang.String.hashCode()'   参考                            在com.android.volley.Request。(Request.java:136)                            在com.android.volley.toolbox.StringRequest。(StringRequest.java:43)                            at in.medma.callbin.LoginActivity $ 5.(LoginActivity.java:0)                            at in.medma.callbin.LoginActivity.requestForSMS(LoginActivity.java:203)                            at in.medma.callbin.LoginActivity.validateForm(LoginActivity.java:189)                            在in.medma.callbin.LoginActivity.onClick(LoginActivity.java:155)

在Fabric crashlytic中我得到了这个

CrashReport

排球请求

private void requestForSMS(final String mobile) {
        StringRequest strReq = new StringRequest(Request.Method.POST,
                Config.URL_REQUEST_SMS, new Response.Listener<String>() {

            @Override
            public void onResponse(String response) {

                try {
                    JSONObject responseObj = new JSONObject(response);

                    // Parsing json object response
                    // response will be a json object
                    boolean error = responseObj.getBoolean("error");
                    String message = responseObj.getString("message");

                    // checking for error, if not error SMS is initiated
                    // device should receive it shortly
                    if (!error) {
                        // boolean flag saying device is waiting for sms
                        pref.setIsWaitingForSms(true);
                        viewPager.setCurrentItem(1);
                        Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();

                    } else {
                        Toast.makeText(getApplicationContext(),
                                "Error: " + message,
                                Toast.LENGTH_LONG).show();
                    }

                    // hiding the progress bar


                } catch (JSONException e) {
                    Toast.makeText(getApplicationContext(),
                            "Error: " + e.getMessage(),
                            Toast.LENGTH_LONG).show();


                }

            }
        }, new Response.ErrorListener() {

            @Override
            public void onErrorResponse(VolleyError error) {
                Log.e(TAG, "Error: " + error.getMessage());
                Toast.makeText(getApplicationContext(),
                        error.getMessage(), Toast.LENGTH_SHORT).show();
            }
        }) {

            /**
             * Passing user parameters to our server
             * @return
             */
            @Override
            protected Map<String, String> getParams() {
                Map<String, String> params = new HashMap<String, String>();
                params.put("mobile", mobile);
                Log.e(TAG, "Posting params: " + params.toString());

                return params;
            }

        };

        // Adding request to request queue
        MyApplication.getInstance().addToRequestQueue(strReq);
    }

2 个答案:

答案 0 :(得分:0)

使用

进行编译
  

编译'eu.the4thfloor.volley:com.android.volley:2015.05.28'

答案 1 :(得分:0)

<强> DEPRECATED 请注意,此项目已弃用,不再维护,请使用正式版本。

编译'com.android.volley:volley:1.0.0'