마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

Http 서버에서 파일을 다운 받는데 isSBSettingEnabled false 에러가 뜹니다

0 추천
public class HttpDownloader extends AsyncTask<String, String, String> {
    private String HttpURL;
    private String DirPath;
    private String FileName;
    private String FileFath;
    private android.os.Handler handler;

    public HttpDownloader(String HttpURL, String FilePath, android.os.Handler handler) {
        this.HttpURL = HttpURL;
        this.DirPath = FilePath.substring(0, FilePath.lastIndexOf('/'));
        this.FileName = FilePath.substring(FilePath.lastIndexOf('/') + 1, FilePath.length());
        this.FileFath = FilePath;
        this.handler = handler;

        File Dir = new File(DirPath);
        if(!Dir.exists()) {
            Dir.mkdir();
        }
        if(new File(DirPath + "/" + FileName).exists()) {
            new File(DirPath + "/" + FileName).delete();
        }
        this.execute();
    }

    @Override
    protected String doInBackground(String... strings) {
        int count;
        try {
            URL url = new URL(HttpURL);
            URLConnection conection = url.openConnection();
            conection.connect();
            // getting file length
            int lenghtOfFile = conection.getContentLength();

            // input stream to read file - with 8k buffer
            InputStream input = new BufferedInputStream(url.openStream(), 8192);

            // Output stream to write file
            OutputStream output = new FileOutputStream(FileFath);

            byte data[] = new byte[1024];

            long total = 0;

            while ((count = input.read(data)) != -1) {
                total += count;
                // publishing the progress....
                // After this onProgressUpdate will be called
                publishProgress(""+(int)((total*100)/lenghtOfFile));

                // writing data to file
                output.write(data, 0, count);
            }

            // flushing output
            output.flush();

            // closing streams
            output.close();
            input.close();

        }
        catch(Exception e) {
            Log.e("Error: ", e.getMessage());
        }

        return null;
    }

    protected void onProgressUpdate(String... progress) {
    }

    @Override
    protected void onPostExecute(String file_url) {
        handler.sendEmptyMessage(0);
    }
}

요렇게 코드를 작성했습니다.

다운로드가 성공적으로 되기는 하는데요. 파일 크기는 70Mb인데 시간이 한 5분은 걸립니다. 그리고

I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
W/art: Suspending all threads took: 12.884ms
W/art: Suspending all threads took: 18.204ms
 I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
W/art: Suspending all threads took: 6.110ms

이렇게 에러가 찍힙니다.

어떤 부분이 잘못인지라도 알 수 있으면 좋을 것 같은데 어디가 잘못인지도 모르겠습니다.

그리고 디버깅은 삼성 갤럭시 S5를 가지고 하고 있습니다.

Acckim (140 포인트) 님이 2017년 8월 7일 질문
코드상으로는 문제는 없어 보이는데요

1개의 답변

0 추천
해결하셨나요?

해결하셨다면 방법을 알려주세요... 똑같은 에러가 뜹니다ㅠ
윤쪼 님이 2019년 1월 3일 답변
...