Android Studio访问网址解析JSON,获取不到数据

问题遇到的现象和发生背景

通过网址解析JSON数据

问题相关代码,请勿粘贴截图
package com.myapp.azurecg.azurecg.activities.novel;

import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;
import com.android.volley.toolbox.JsonRequest;
import com.android.volley.toolbox.Volley;
import com.myapp.azurecg.azurecg.R;
import com.myapp.azurecg.azurecg.adapters.Novel_ReyclerViewAdapter;
import com.myapp.azurecg.azurecg.model.Listitem;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class novelActivity extends AppCompatActivity {
    private String JSON_URL = "https://raw.githubusercontent.com/dearyangyun/bysj/stories/chg.json";
    private InputStream inputStream;
    private JsonRequest jsonRequest;
    private List<Listitem> listItem;
    private RecyclerView recyclerView;
    private TextView content;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_novel_read);

        //获取传过来的数据即网址
        String read_url = getIntent().getExtras().getString("listitem_read");
        TextView tv_read = findViewById(R.id.n_url);
        //content = findViewById(R.id.story);
        //将获取的数据调用
        tv_read.setText(read_url);
        listItem = new ArrayList<>();//创建一个listAnime的数组
        content = findViewById(R.id.story);
        jsonrequest();//执行定义的方法

    }

    private void parseJsonData(String jsonStr){
        try {
            JSONObject jsonObject = new JSONObject(jsonStr);

            String readstory = jsonObject.getString("stroy");
            content.setText(readstory);

        }catch (JSONException e){
            e.printStackTrace();
        }
    }

    private void jsonrequest() {
        jsonRequest = new JsonArrayRequest(JSON_URL, new Response.Listener<JSONArray>() {
            @Override
            public void onResponse(JSONArray response) {

                JSONObject jsonObject = null;

                for (int i = 0 ; i < response.length(); i++) {

                    try {
                        jsonObject = response.getJSONObject(i);//获取从网上获取生成到方法的项目用于设置Anime类里面的值
                        Listitem listitem = new Listitem();
                        listitem.setRead_url(jsonObject.getString("read"));
                        listItem.add(listitem);//将每次循环定义的单个Anime类添加进listAnime列表

                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
                content.setText((CharSequence) listItem);
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {

            }
        });

    }

}


运行结果及报错内容

程序界面没有显示结果,debug没有显示数据,完全看不懂

我的解答思路和尝试过的方法

我也试过用以下的方法连接网址(从其他网址获取到的,可以正常显示),也是没显示数据,debug了同样没显示数据

public class novelActivity extends AppCompatActivity {

    private TextView content;

    @RequiresApi(api = Build.VERSION_CODES.KITKAT)
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_novel_read);

        //获取传过来的数据即网址
        String read_url = getIntent().getExtras().getString("listitem_read");
        TextView tv_read = findViewById(R.id.n_url);
        content = findViewById(R.id.story);
        //将获取的数据调用
        tv_read.setText(read_url);
        String url = doGet(read_url);
        parseJsonData(read_url);

    }

    private void parseJsonData(String jsonStr){
        try {
            JSONObject jsonObject = new JSONObject(jsonStr);

            String readstory = jsonObject.getString("stroy");
            content.setText(readstory);

        }catch (JSONException e){
            e.printStackTrace();
        }
    }


    @RequiresApi(api = Build.VERSION_CODES.KITKAT)
    public static String doGet(String url) {
        HttpURLConnection urlConnection = null;
        BufferedReader reader = null;
        String bookJSONString = null;

        try {
            // 1.建立连接
            URL requestURL = new URL(url);
            urlConnection = (HttpURLConnection) requestURL.openConnection();
            urlConnection.setRequestMethod("GET");
            urlConnection.setConnectTimeout(5000);
            urlConnection.setRequestProperty("Charset", "utf-8");
            urlConnection.connect();

            // 2.从连接里获取输入流(二进制)
            InputStream inputStream = urlConnection.getInputStream();

            // 3.将输入流包装转换成 BufferedReader (我们人易懂的文本)
            reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));

            // 4.从 BufferedReader 中一行行读取字符串,用 StringBuilder 接收
            StringBuilder builder = new StringBuilder();

            String line;
            while ((line = reader.readLine()) != null) {
                builder.append(line);
//                builder.append("\n");
            }

            if (builder.length() == 0) {
                return null;
            }

            // 5.StringBuilder拼接成最终的字符串文本
            bookJSONString = builder.toString();

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            // 关闭连接
            if (urlConnection != null) {
                urlConnection.disconnect();
            }
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return bookJSONString;
    }

}

我想要达到的结果

我想要通过String read_url = getIntent().getExtras().getString("listitem_read");获取到的网址,访问该网址并解析JSON数据,然后把数据显示在TextView中。
read_url的网址是可以显示的,我实在是不懂哪出错了。

每个步骤加日志,分析走到哪一步,数据是什么样的,debug逐步分析也可以

1.检查AndroidManifest有没有给网络权限
2.安卓7.0以上对网络访问有限制,需要配置。
1.在AndroidManifest的application标签下添加 android:networkSecurityConfig="@xml/network_config"
2.在res下创建xml文件夹,创建network_config文件,里面内容如下:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>