Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
FileNotFoundException URL Android Studio_Android_Url_Android Studio_Filenotfoundexception - Fatal编程技术网

FileNotFoundException URL Android Studio

FileNotFoundException URL Android Studio,android,url,android-studio,filenotfoundexception,Android,Url,Android Studio,Filenotfoundexception,我在一个URL中有一个FileNotFoundException,它似乎在HttpURLConnection上不起作用,因为它在浏览器中运行。 该连接在其他URL上工作。 URL有一个200状态代码,因此它有一个普通代码 这是AssyncTask代码: private class CrearRegistroTask extends AsyncTask<String, Void, String> { /* EJEMPLO DE LA CREACIÓN DE UN REG

我在一个URL中有一个FileNotFoundException,它似乎在HttpURLConnection上不起作用,因为它在浏览器中运行。 该连接在其他URL上工作。 URL有一个200状态代码,因此它有一个普通代码

这是AssyncTask代码:

private class CrearRegistroTask extends AsyncTask<String, Void, String> {
    /*
    EJEMPLO DE LA CREACIÓN DE UN REGISTRO
     */
    @Override
    protected String doInBackground(String... params) {
        InputStream iS = null;
        String data="";
        try {
            URL url = new URL("http://user:pass@denunciaty.florida.com.mialias.net/api/reporte/nuevo/Prueba3/Descripcion3/1/Ejempo/2/5/senyal");
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setReadTimeout(10000);
            con.setConnectTimeout(15000);
            con.setRequestMethod("GET");
            con.setDoInput(true);
            con.connect();

            iS = new BufferedInputStream(con.getInputStream());
            con.getResponseCode();
            if (iS != null) {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(iS));
                String line = "";

                while ((line = bufferedReader.readLine()) != null)
                    data += line;
            }
            iS.close();

            return data;
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if(iS !=null){
                try {
                    iS.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return data;
    }

    @Override
    protected void onPostExecute(String s) {
        super.onPostExecute(s);
        tv.setText(s);
    }
}`
私有类CrearRegistroTask扩展了异步任务{
/*
联合国登记处职员
*/
@凌驾
受保护的字符串doInBackground(字符串…参数){
InputStream=null;
字符串数据=”;
试一试{
URL=新URL(“http://user:pass@denunciaty.florida.com.mialias.net/api/reporte/nuevo/Prueba3/descripion3/1/Ejempo/2/5/senyal);
HttpURLConnection con=(HttpURLConnection)url.openConnection();
con.setReadTimeout(10000);
con.设置连接超时(15000);
con.setRequestMethod(“GET”);
con.setDoInput(真);
con.connect();
iS=新的BufferedInputStream(con.getInputStream());
con.getResponseCode();
如果(iS!=null){
BufferedReader BufferedReader=新的BufferedReader(新的InputStreamReader(iS));
字符串行=”;
而((line=bufferedReader.readLine())!=null)
数据+=行;
}
iS.close();
返回数据;
}捕获(IOE异常){
e、 printStackTrace();
}最后{
如果(iS!=null){
试一试{
iS.close();
}捕获(IOE异常){
e、 printStackTrace();
}
}
}
返回数据;
}
@凌驾
受保护的void onPostExecute(字符串s){
super.onPostExecute(s);
tv.setText(s);
}
}`

`

此url要求您必须登录。因此,您还必须传递登录详细信息。我收到此消息=>需要授权此服务器无法验证您是否有权访问请求的文档。您提供了错误的凭据(例如,错误的密码),或者您的浏览器不了解如何提供所需的凭据。检查此=>此url要求您必须登录。因此,您还必须传递登录详细信息。我收到此消息=>需要授权此服务器无法验证您是否有权访问请求的文档。您提供了错误的凭据(例如,错误的密码),或者您的浏览器不了解如何提供所需的凭据。请检查此项=>