Android 应用程序不使用wifi连接到web服务,但其他应用程序工作正常

Android 应用程序不使用wifi连接到web服务,但其他应用程序工作正常,android,android-wifi,Android,Android Wifi,请检查一下这个日志。我已经连接到wifi,在我的android手机上安装了其他应用程序,可以正常工作, 但我的应用程序无法连接到web服务,它在下面提到的catlog中显示错误。 我已设置权限: 以下是日志: 03-09 21:29:01.634: E/WifiStateMachine(630): WiFiStateMachine SCAN ALARM 03-09 21:29:01.636: E/WifiStateMachine(630): ConnectedState (when=-1m

请检查一下这个日志。我已经连接到wifi,在我的android手机上安装了其他应用程序,可以正常工作, 但我的应用程序无法连接到web服务,它在下面提到的catlog中显示错误。 我已设置权限:


以下是日志:

03-09 21:29:01.634: E/WifiStateMachine(630): WiFiStateMachine SCAN ALARM
03-09 21:29:01.636: E/WifiStateMachine(630):  ConnectedState (when=-1ms what=131143 arg1=-2 arg2=-2) !CMD_START_SCAN -2 -2 ic=32 proc(ms):1 dur:334 rssi=-40 f=2462 sc=60 link=65 tx=0.0, 0.0, 0.0  rx=0.0 list=2462 [on:0 tx:0 rx:0 period:1193] from screen [on:0 period:1545228292]
03-09 21:29:01.637: E/WifiStateMachine(630):  L2ConnectedState (when=-3ms what=131143 arg1=-2 arg2=-2) !CMD_START_SCAN -2 -2 ic=32 proc(ms):3 dur:334 rssi=-40 f=2462 sc=60 link=65 tx=0.0, 0.0, 0.0  rx=0.0 list=2462 [on:0 tx:0 rx:0 period:1] from screen [on:0 period:1545228293]
03-09 21:29:01.638: E/WifiStateMachine(630): WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=any RSSI=-40
03-09 21:29:01.638: E/WifiStateMachine(630): WifiStateMachine CMD_START_SCAN with age=80460 interval=227812 maxinterval=300000
03-09 21:29:01.638: E/WifiStateMachine(630): WifiStateMachine CMD_START_SCAN full=false
03-09 21:29:01.638: E/WifiConfigStore(630): makeChannelList age=3600000 for "customsoft2"WPA_PSK max=6 bssids=1
03-09 21:29:01.638: E/WifiConfigStore(630): has 88:53:95:28:9a:f9 freq=2462 age=1199 ?=true
03-09 21:29:01.638: E/WifiStateMachine(630): WifiStateMachine starting scan for "customsoft2"WPA_PSK with 2462
03-09 21:29:01.638: E/WifiStateMachine(630): stopReconnectWifi Wfd=false StopScan=false mDontReconnectAndScan=false
03-09 21:29:01.640: E/WifiStateMachine(630): [1,457,539,141,639 ms] noteScanstart no scan source
03-09 21:29:01.641: E/WifiMonitor(630): handleEvent unknown: 15  CTRL-EVENT-SCAN-STARTED 
03-09 21:29:01.671: E/MPlugin(1622): Unsupported class: com.mediatek.common.telephony.IOnlyOwnerSimSupport
03-09 21:29:01.807: E/WifiTrafficPoller(630): TRAFFIC_STATS_POLL true Token 33 num clients 8
03-09 21:29:01.807: E/WifiTrafficPoller(630):  packet count Tx=209 Rx=256
03-09 21:29:01.987: E/WifiStateMachine(630):  ConnectedState (when=-1ms what=147461!SCAN_RESULTS_EVENT 0 0 found=4 known=2 got=4 bcn=0
03-09 21:29:01.988: E/WifiStateMachine(630):  L2ConnectedState (when=-2ms what=147461!SCAN_RESULTS_EVENT 0 0 found=4 known=2 got=4 bcn=0
03-09 21:29:01.989: E/WifiStateMachine(630):  ConnectModeState (when=-2ms what=147461!SCAN_RESULTS_EVENT 0 0 found=4 known=2 got=4 bcn=0
03-09 21:29:01.989: E/WifiStateMachine(630):  DriverStartedState (when=-3ms what=147461!SCAN_RESULTS_EVENT 0 0 found=4 known=2 got=4 bcn=0
03-09 21:29:01.990: E/WifiStateMachine(630):  SupplicantStartedState (when=-3ms what=147461!SCAN_RESULTS_EVENT 0 0 found=4 known=2 got=4 bcn=0
03-09 21:29:01.990: E/WifiStateMachine(630): [1,457,539,141,990 ms] noteScanEnd no scan source
03-09 21:29:01.994: E/WifiStateMachine(630): wifi setScanResults statecom.android.server.wifi.WifiStateMachine$ConnectedState@39784b18 sup_state=COMPLETED debouncing=false
03-09 21:29:01.994: E/WifiConfigStore(630): updateSavedNetworkHistory(): SSID mismatch "customsoft"WPA_PSK SSID="customsoft" "customsoft2"
03-09 21:29:01.994: E/WifiConfigStore(630): updateSavedNetworkHistory(): SSID mismatch "customsoft2's Mac mini"WPA_PSK SSID="customsoft2's Mac mini" "customsoft2"
03-09 21:29:01.995: E/WifiConfigStore(630): updateSavedNetworkHistory(): try "customsoft2"WPA_PSK SSID="customsoft2" customsoft2 [WPA2-PSK-CCMP][ESS] ajst=0
03-09 21:29:01.995: E/WifiConfigStore(630): linkConfiguration try to link due to DBDC BSSID match "customsoft" and "customsoft2" bssida 88:53:95:28:9a:f9 bssidb 88:53:95:28:8c:31
03-09 21:29:01.995: E/WifiConfigStore(630):         got known scan result 88:53:95:28:9a:f9 key : "customsoft2"WPA_PSK num: 1 rssi=-43 freq=2462
03-09 21:29:01.995: E/WifiConfigStore(630): updateSavedNetworkHistory(): try "customsoft"WPA_PSK SSID="customsoft" customsoft [WPA2-PSK-CCMP][ESS] ajst=128
03-09 21:29:01.995: E/WifiConfigStore(630): linkConfiguration try to link due to DBDC BSSID match "customsoft2" and "customsoft" bssida 88:53:95:28:8c:31 bssidb 88:53:95:28:9a:f9
03-09 21:29:01.995: E/WifiConfigStore(630):         got known scan result 88:53:95:28:8c:31 key : "customsoft"WPA_PSK num: 1 rssi=-54 freq=2462
03-09 21:29:01.995: E/WifiConfigStore(630): updateSavedNetworkHistory(): SSID mismatch "customsoft2's Mac mini"WPA_PSK SSID="customsoft2's Mac mini" "customsoft"
03-09 21:29:01.995: E/WifiConfigStore(630): updateSavedNetworkHistory(): SSID mismatch "customsoft2"WPA_PSK SSID="customsoft2" "customsoft"
03-09 21:29:01.996: E/WifiConfigStore(630): updateSavedNetworkHistory(): SSID mismatch "customsoft"WPA_PSK SSID="customsoft" "Joispot-wifi"
03-09 21:29:01.996: E/WifiConfigStore(630): updateSavedNetworkHistory(): SSID mismatch "customsoft2's Mac mini"WPA_PSK SSID="customsoft2's Mac mini" "Joispot-wifi"
03-09 21:29:01.996: E/WifiConfigStore(630): updateSavedNetworkHistory(): SSID mismatch "customsoft2"WPA_PSK SSID="customsoft2" "Joispot-wifi"
03-09 21:29:01.996: E/WifiConfigStore(630): associateWithConfiguration(): try "Joispot-wifi"
03-09 21:29:01.996: E/WifiConfigStore(630): updateSavedNetworkHistory(): SSID mismatch "customsoft"WPA_PSK SSID="customsoft" "Nanostuffs-Hathway"
03-09 21:29:01.996: E/WifiConfigStore(630): updateSavedNetworkHistory(): SSID mismatch "customsoft2's Mac mini"WPA_PSK SSID="customsoft2's Mac mini" "Nanostuffs-Hathway"
03-09 21:29:01.996: E/WifiConfigStore(630): updateSavedNetworkHistory(): SSID mismatch "customsoft2"WPA_PSK SSID="customsoft2" "Nanostuffs-Hathway"
03-09 21:29:01.996: E/WifiConfigStore(630): associateWithConfiguration(): try "Nanostuffs-Hathway"-WPA_PSK
03-09 21:29:01.997: E/WifiConfigStore(630): updateSavedNetworkHistory(): SSID mismatch "customsoft"WPA_PSK SSID="customsoft" "ICAI"
03-09 21:29:01.997: E/WifiConfigStore(630): updateSavedNetworkHistory(): SSID mismatch "customsoft2's Mac mini"WPA_PSK SSID="customsoft2's Mac mini" "ICAI"
03-09 21:29:01.997: E/WifiConfigStore(630): updateSavedNetworkHistory(): SSID mismatch "customsoft2"WPA_PSK SSID="customsoft2" "ICAI"
03-09 21:29:01.997: E/WifiConfigStore(630): associateWithConfiguration(): try "ICAI"-WPA_PSK
03-09 21:29:01.999: E/WifiConfigStore(630):  writeKnownNetworkHistory() num networks:3 needWrite=false
03-09 21:29:02.808: E/WifiTrafficPoller(630): TRAFFIC_STATS_POLL true Token 33 num clients 8
03-09 21:29:02.810: E/WifiTrafficPoller(630):  packet count Tx=209 Rx=256
03-09 21:29:03.444: E/WifiStateMachine(630):  ConnectedState (when=-2ms what=131155 arg1=3!CMD_RSSI_POLL 3 0 "customsoft2" 88:53:95:28:9a:f9 rssi=-40 f=2462 sc=60 link=65 tx=0.0, 0.0, 0.0  rx=0.0 bcn=0 [on:0 tx:0 rx:0 period:1804] from screen [on:0 period:1545230100] gl hn u24 rssi=-35 ag=0 hr ticks 0,0,0 ls-=0 [56,56,56,56,61] brc=0 lrc=0
03-09 21:29:03.445: E/WifiStateMachine(630):  L2ConnectedState (when=-4ms what=131155 arg1=3!CMD_RSSI_POLL 3 0 "customsoft2" 88:53:95:28:9a:f9 rssi=-40 f=2462 sc=60 link=65 tx=0.0, 0.0, 0.0  rx=0.0 bcn=0 [on:0 tx:0 rx:0 period:1] from screen [on:0 period:1545230101] gl hn u24 rssi=-35 ag=0 hr ticks 0,0,0 ls-=0 [56,56,56,56,61] brc=0 lrc=0
03-09 21:29:03.445: E/WifiStateMachine(630):  get link layer stats 0
03-09 21:29:03.468: E/WifiConfigStore(630): updateConfiguration freq=2462 BSSID=88:53:95:28:9a:f9 RSSI=-41 "customsoft2"WPA_PSK
03-09 21:29:03.809: E/WifiTrafficPoller(630): TRAFFIC_STATS_POLL true Token 33 num clients 8
03-09 21:29:03.811: E/WifiTrafficPoller(630):  packet count Tx=209 Rx=256
03-09 21:29:04.812: E/WifiTrafficPoller(630): TRAFFIC_STATS_POLL true Token 33 num clients 8
03-09 21:29:04.813: E/WifiTrafficPoller(630):  packet count Tx=209 Rx=256
03-09 21:29:05.815: E/WifiTrafficPoller(630): TRAFFIC_STATS_POLL true Token 33 num clients 8
03-09 21:29:05.817: E/WifiTrafficPoller(630):  packet count Tx=209 Rx=256
03-09 21:29:06.474: E/WifiStateMachine(630):  ConnectedState (when=-4ms what=131155 arg1=3!CMD_RSSI_POLL 3 0 "customsoft2" 88:53:95:28:9a:f9 rssi=-40 f=2462 sc=60 link=65 tx=0.0, 0.0, 0.0  rx=0.0 bcn=0 [on:0 tx:0 rx:0 period:3002] from screen [on:0 period:1545233130] gl hn u24 rssi=-35 ag=0 hr ticks 0,0,0 ls-=0 [56,56,56,56,61] brc=0 lrc=0
03-09 21:29:06.478: E/WifiStateMachine(630):  L2ConnectedState (when=-8ms what=131155 arg1=3!CMD_RSSI_POLL 3 0 "customsoft2" 88:53:95:28:9a:f9 rssi=-40 f=2462 sc=60 link=65 tx=0.0, 0.0, 0.0  rx=0.0 bcn=0 [on:0 tx:0 rx:0 period:4] from screen [on:0 period:1545233134] gl hn u24 rssi=-35 ag=0 hr ticks 0,0,0 ls-=0 [56,56,56,56,61] brc=0 lrc=0
03-09 21:29:06.479: E/WifiStateMachine(630):  get link layer stats 0
03-09 21:29:06.505: E/WifiConfigStore(630): updateConfiguration freq=2462 BSSID=88:53:95:28:9a:f9 RSSI=-40 "customsoft2"WPA_PSK
03-09 21:29:06.818: E/WifiTrafficPoller(630): TRAFFIC_STATS_POLL true Token 33 num clients 8
03-09 21:29:06.821: E/WifiTrafficPoller(630):  packet count Tx=209 Rx=256
03-09 21:29:07.823: E/WifiTrafficPoller(630): TRAFFIC_STATS_POLL true Token 33 num clients 8
03-09 21:29:07.827: E/WifiTrafficPoller(630):  packet count Tx=209 Rx=256
03-09 21:29:08.830: E/WifiTrafficPoller(630): TRAFFIC_STATS_POLL true Token 33 num clients 8
03-09 21:29:08.833: E/WifiTrafficPoller(630):  packet count Tx=209 Rx=256
03-09 21:29:09.512: E/WifiStateMachine(630):  ConnectedState (when=-3ms what=131155 arg1=3!CMD_RSSI_POLL 3 0 "customsoft2" 88:53:95:28:9a:f9 rssi=-40 f=2462 sc=60 link=65 tx=0.0, 0.0, 0.0  rx=0.0 bcn=0 [on:0 tx:0 rx:0 period:2980] from screen [on:0 period:1545236168] gl hn u24 rssi=-35 ag=0 hr ticks 0,0,0 ls-=0 [56,56,56,56,61] brc=0 lrc=0
03-09 21:29:09.515: E/WifiStateMachine(630):  L2ConnectedState (when=-6ms what=131155 arg1=3!CMD_RSSI_POLL 3 0 "customsoft2" 88:53:95:28:9a:f9 rssi=-40 f=2462 sc=60 link=65 tx=0.0, 0.0, 0.0  rx=0.0 bcn=0 [on:0 tx:0 rx:0 period:3] from screen [on:0 period:1545236171] gl hn u24 rssi=-35 ag=0 hr ticks 0,0,0 ls-=0 [56,56,56,56,61] brc=0 lrc=0
03-09 21:29:09.517: E/WifiStateMachine(630):  get link layer stats 0
03-09 21:29:09.544: E/WifiConfigStore(630): updateConfiguration freq=2462 BSSID=88:53:95:28:9a:f9 RSSI=-40 "customsoft2"WPA_PSK
03-09 21:29:09.833: E/WifiTrafficPoller(630): TRAFFIC_STATS_POLL true Token 33 num clients 8
03-09 21:29:09.836: E/WifiTrafficPoller(630):  packet count Tx=209 Rx=256
03-09 21:29:10.838: E/WifiTrafficPoller(630): TRAFFIC_STATS_POLL true Token 33 num clients 8
03-09 21:29:10.841: E/WifiTrafficPoller(630):  packet count Tx=209 Rx=256
代码如下:

public class JSONParser {

private InputStream is = null;
private JSONObject jObj = null;
private String json = "";

// constructor
public JSONParser() {

}

// function get json from url
// by making HTTP POST or GET mehtod
public JSONObject makeHttpRequest(String url, String method,
        List<NameValuePair> params) {


    try {

        HttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost(url);
        httpPost.setEntity(new UrlEncodedFormEntity(params));

        // execute HTTP post request
        HttpResponse response = httpClient.execute(httpPost);
        HttpEntity resEntity = response.getEntity();


            is = resEntity.getContent();



    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                is, "iso-8859-1"), 8);
        StringBuilder sb = new StringBuilder();
        String line = null;
        while ((line = reader.readLine()) != null) {
            sb.append(line + "\n");
        }
        is.close();
        json = sb.toString();
    } catch (Exception e) {
        Log.e("Buffer Error", "Error converting result " + e.toString());
    }

    // try parse the string to a JSON object
    try {
        jObj = new JSONObject(json);
    } catch (JSONException e) {
        Log.e("JSON Parser", "Error parsing data " + e.toString());
    }

    // return JSON String
    return jObj;

}
公共类JSONParser{
私有InputStream为空;
私有JSONObject jObj=null;
私有字符串json=“”;
//建造师
公共JSONParser(){
}
//函数从url获取json
//通过使用HTTP POST或GET方法
公共JSONObject makeHttpRequest(字符串url、字符串方法、,
列表参数){
试一试{
HttpClient HttpClient=新的DefaultHttpClient();
HttpPost HttpPost=新的HttpPost(url);
setEntity(新的UrlEncodedFormEntity(参数));
//执行HTTP post请求
HttpResponse response=httpClient.execute(httpPost);
HttpEntity当前性=response.getEntity();
is=resEntity.getContent();
}捕获(不支持的编码异常e){
e、 printStackTrace();
}捕获(客户端协议例外e){
e、 printStackTrace();
}捕获(IOE异常){
e、 printStackTrace();
}
试一试{
BufferedReader reader=新的BufferedReader(新的InputStreamReader(
is,“iso-8859-1”),8);
StringBuilder sb=新的StringBuilder();
字符串行=null;
而((line=reader.readLine())!=null){
sb.追加(第+行“\n”);
}
is.close();
json=sb.toString();
}捕获(例外e){
Log.e(“缓冲区错误”,“错误转换结果”+e.toString());
}
//尝试将字符串解析为JSON对象
试一试{
jObj=新的JSONObject(json);
}捕获(JSONException e){
Log.e(“JSON解析器”,“错误解析数据”+e.toString());
}
//返回JSON字符串
返回jObj;
}

}

请在应用程序启动时添加代码段。我一开始就启动了远程服务。每次catlog被这个错误填满时,你都不是认真的。此日志与Web服务有什么关系?您应该发布引发这些错误消息的代码。谢谢greenapps,此错误不仅适用于应用程序,它还会在应用程序停止和卸载后持续显示。我换了2个手机1个。intex水速2。联想。。。两者都有相同的问题请删除不相关的日志。然后解释什么不起作用。发布应用程序仅生成的错误日志。请在应用程序启动时添加代码段。我一开始就启动了远程服务。每次catlog被这个错误填满时,你都不是认真的。此日志与Web服务有什么关系?您应该发布引发这些错误消息的代码。谢谢greenapps,此错误不仅适用于应用程序,它还会在应用程序停止和卸载后持续显示。我换了2个手机1个。intex水速2。联想。。。两者都有相同的问题请删除不相关的日志。然后解释什么不起作用。发布应用程序仅生成的错误日志。