0

首先我的错误是这个:

无法解析主机“”;没有与主机名关联的地址

然后我在清单中添加

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

错误开始是这个:

10-29 07:18:37.078: E/Erro H:(1485): 20000 毫秒后无法连接到 mywebsite.com/82.102.6.211(端口 80)

它下载字节图像,但在 10/20 秒后它停止并给出该错误。

在我的清单中,我目前有:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

我目前正在通过网络服务从图像中下载字节,我说的是 500 张图像。

这可能是问题吗?谢谢。

编辑:下载代码:

private class productsAsync extends AsyncTask<Void, Integer, String> {
    @Override
    protected String doInBackground(Void... params) {
        try{        
            for(int i = 0; i <= all_ids.size() - 1; i++){

                SoapObject request = new SoapObject(NAMESPACE+ "/", "get_all_products_images"); 

                request.addProperty("id", all_ids.get(i));

                SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                envelope.setOutputSoapObject(request);
                HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
                androidHttpTransport.call(URL + "/get_all_products_images", envelope);

                SoapObject rep = (SoapObject) envelope.bodyIn;
                JSONArray jr = new JSONArray(rep.getPropertyAsString(0)); 

                JSONObject jb = (JSONObject) jr.get(0); 
                byte[] theImage = jb.getString("image").getBytes(); 
                boolean isNull = (jb.getString("image") == null ? true : false);                    

                db.updateImage(theImage, jb.getInt("product_id"), isNull);
            }
        }catch (Exception e){
            Log.e("Error:", e.getMessage());
        }
        return "Executed";
    }
}
4

0 回答 0