【问题标题】:How to fix NetworkUtility.shouldRetryException: Unexpected response code 404如何修复 NetworkUtility.shouldRetryException:意外的响应代码 404
【发布时间】:2023-01-13 07:26:29
【问题描述】:

我正在使用 gofile 链接,但是当我调用它时出现此错误

 E/Volley: [4463] NetworkUtility.shouldRetryException: Unexpected response code 404 for https://api.gofile.io/getFolder?folderId=XuxRGg

我也附上代码部分

public class GoFile {
    public interface goFileCallback {
        void onSuccess(String result);
        void onError(VolleyError error);
    }

    public static void getStreamLink(Context context, String url, final goFileCallback callback) {
        String[] parts = url.split("/");
        String id = parts[4];
        RequestQueue queue = Volley.newRequestQueue(context);
        StringRequest sr = new StringRequest(com.android.volley.Request.Method.GET, "https://api.gofile.io/getFolder?folderId="+id, response -> {
            JsonObject jsonObject = new Gson().fromJson(response, JsonObject.class);
            JsonObject data = jsonObject.get("data").getAsJsonObject();
            JsonObject contents = data.get("contents").getAsJsonObject();
            for (String keyStr : contents.keySet()) {
                JsonObject md5 = contents.get(keyStr).getAsJsonObject();
                String link = md5.get("link").getAsString();
                callback.onSuccess(link);
            }
        }, error -> callback.onError(error));
        queue.add(sr);
    }
}

如果有人帮我解决这个问题,我会很高兴

【问题讨论】:

    标签: java android json networking android-volley


    【解决方案1】:

    您应该仔细检查链接“https://api.gofile.io/getFolder?folderId=XuxRGg”。在 chrome 中输入它也会返回 404。

    【讨论】:

    • 实际上,当我键入它时,它显示无法获取/getFolder。我是从 codecanyon 买的,我尽了最大努力分析整个代码,但我仍然无法理解开发人员如何从 url 中获取文件夹 ID 实际上在 gofile api 中它显示为“api.gofile.io/getServer
    • 根据本网站 API gofile.io/api
    【解决方案2】:

    说 404_Not Found 响应代码 - 检查 api 链接并找到 http_response_code(404)(在 php 中)- 数据库中可能没有响应

    【讨论】:

      猜你喜欢
      • 2021-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-10
      • 1970-01-01
      • 2015-06-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多