猿问

java.lang.String 类型的 value 数据无法转换为 JSONObject

你能帮忙吗,为什么我在 logcat 中收到此错误?最近,自从我迁移到 SDK 28 后一切正常,但失败了。但我不确定这是 SDK 28 的问题。付款正常(用户收到付款,但 Intent 不起作用,在 Logcat 中我收到此错误)


你能建议一下吗?谢谢


public void sendPayment(String type) {

            ProjectUtils.showProgressDialog(mContext, true, getResources().getString(R.string.please_wait));

            new HttpsRequest(Consts.MAKE_PAYMENT_API, getParms(type), mContext).stringPost(TAG, new Helper() {

                @Override

                public void backResponse(boolean flag, String msg, JSONObject response) {

                    ProjectUtils.pauseProgressDialog();

                    if (flag) {

                        ProjectUtils.showToast(mContext, msg);

                        Intent in = new Intent(mContext, WriteReview.class);

                        in.putExtra(Consts.HISTORY_DTO, historyDTO);

                        startActivity(in);

                        finish();

                    } else {

                        ProjectUtils.showToast(mContext, msg);


                    }

                }

            });

        }

    public Map<String, String> getParms(String type) {

            HashMap<String, String> params = new HashMap<>();

            params.put(Consts.INVOICE_ID, historyDTO.getInvoice_id());

            params.put(Consts.USER_ID, userDTO.getUser_id());

            params.put(Consts.COUPON_CODE, coupon_code);

            params.put(Consts.FINAL_AMOUNT, final_amount);

            params.put(Consts.PAYMENT_STATUS, "1");

            params.put(Consts.PAYMENT_TYPE, type);

            params.put(Consts.DISCOUNT_AMOUNT, discount_amount);


            Log.e("sendPaymentConfirm", params.toString());

            return params;

        }

更新:错误


sendPaymentConfirm: {payment_type=1, final_amount=150, discount_amount=0, invoice_id=RCVG2QNWBHCP, payment_status=1, user_id=614, coupon_code=}


PaymentProActivity:  error body --->null error msg --->org.json.JSONException: Value <div of type java.lang.String cannot be converted to JSONObject


米脂
浏览 123回答 1
1回答

湖上湖

通过从 PHP 7.2 降级到 PHP 7.1 解决了问题
随时随地看视频慕课网APP

相关分类

Java
我要回答