NetworkSecurityConfig:未指定网络安全配置——Android 7.0 错误? [英] NetworkSecurityConfig: No Network Security Config specified -- Android 7.0 error?

查看:64
本文介绍了NetworkSecurityConfig:未指定网络安全配置——Android 7.0 错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 android 7.0.0 有一些问题.

I have some problem for android 7.0.0.

我的应用程序使用了 volley 库,它运行良好,除了 Android 7.0

I use volley library for my application, and it works well except for Android 7.0

这是我的代码的一部分;

Here is part of my code;

String url_goster = "http://185.126.217.71/clog.php";
RequestQueue requestQueue;

StringRequest request= new StringRequest(Request.Method.POST, url_goster, new Response.Listener<String>() {
    @Override
    public void onResponse(String response) {
        JSONObject veri_json;
        try {
            veri_json = new JSONObject(response);
            JSONArray serial_no = veri_json.getJSONArray("Bilgiler");

            for (int i = 0; i< serial_no.length(); i++){
                JSONObject bilgis = serial_no.getJSONObject(i);

                // JSON olarak verileri çekiyoruz
                String GELEN_SERIAL = bilgis.getString("GELEN_SERIAL");
                String TERMINAL_ADI = bilgis.getString("TERMINAL_ADI");
                String SICAKLIK_T1 = bilgis.getString("SICAKLIK_T1");
                String SICAKLIK_T2 = bilgis.getString("SICAKLIK_T2");
                String SICAKLIK_T3 = bilgis.getString("SICAKLIK_T3");
                String SON_DATA = bilgis.getString("SON_DATA");
                String NEM_H1 = bilgis.getString("NEM_H1");
                String NEM_H2 = bilgis.getString("NEM_H2");
                String NEM_H3 = bilgis.getString("NEM_H3");
                String SENSOR_1_AD = bilgis.getString("SENSOR_1_AD");
                String SENSOR_2_AD = bilgis.getString("SENSOR_2_AD");
                String SENSOR_3_AD = bilgis.getString("SENSOR_3_AD");
                int SENSOR_SAYISI = bilgis.getInt("SENSOR_SAYISI");

                kisiler.add(new Kisi(TERMINAL_ADI, SON_DATA, SENSOR_1_AD, SENSOR_2_AD, SENSOR_3_AD, SICAKLIK_T1, SICAKLIK_T2, SICAKLIK_T3, NEM_H1, NEM_H2, NEM_H3, GELEN_SERIAL, SENSOR_SAYISI));
            }
        } catch (JSONException e) {
            Log.e("JSON ALIRKEN HATA",e.getLocalizedMessage());

            Toast.makeText(getApplicationContext(), "Server'a bağlanılırken bir hata ile karşılaşıldı.", Toast.LENGTH_SHORT).show();
        }
    }
    }, new Response.ErrorListener() {
           @Override
           public void onErrorResponse(VolleyError error) {

           }
       }){
            @Override
            protected Map<String, String> getParams() throws AuthFailureError {
                Map<String,String> params = new HashMap<String,String>();
                params.put("ad",USER);
                return params;
            }
        };
        requestQueue.add(request);
    }

如果我在 Android 7.0 上测试我的应用程序,控制台的输出是;

If I test my application on Android 7.0, the output of console is;

D/NetworkSecurityConfig:未指定网络安全配置,使用平台默认 I/Choreographer:跳过 127 帧!应用程序可能在其主线程上做了太多工作.

D/NetworkSecurityConfig: No Network Security Config specified, using platform default I/Choreographer: Skipped 127 frames! The application may be doing too much work on its main thread.

但这只会发生在 Android 7.0 并且应用程序看起来空白,因为它没有从互联网上得到响应

but this only happens Android 7.0 and application looks blank because it doesn't get a response from the internet

.我该如何解决这个问题?

. How can i solve this problem ?

推荐答案

这个帖子没有问题:

D/NetworkSecurityConfig: No Network Security Config specified, using platform default 

D/ 表示这是一条调试消息.它表示您没有定义自己的网络安全配置,因此平台默认规则适用.这完全没问题.

The D/ indicates that this is a debugging message. It indicates that you do not have your own network security configuration defined, and so platform-default rules apply. This is perfectly fine.

应用程序看起来是空的,因为它没有从互联网响应

application looks empty because it does not response from the internet

据我所知,您正在解析一些 JSON,对其进行迭代并填充 kisiler.可能 kisiler 未连接到您的用户界面.

Near as I can tell, you are parsing some JSON, iterating over it, and populating kisiler. Perhaps kisiler is not connected to your UI.

这篇关于NetworkSecurityConfig:未指定网络安全配置——Android 7.0 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆