posted 4 years ago
Here is the code that i found on net and seems to be the right code but for some reason every time I run it, it keeps crashing on me and i have been searching the net alll day and i have't been able to solve it. here is the code
try {
URLConnection conn = new URL("http://50.7.70.58:8708").openConnection();
InputStream is = conn.getInputStream();
OutputStream outstream = new FileOutputStream(new File("/mnt/sdcard/Download/file.mp3"));
byte[] buffer = new byte[4096];
int len;
while ((len = is.read(buffer)) > 0) {
outstream.write(buffer, 0, len);
}
outstream.close();
} catch (IOException e) {
e.printStackTrace();
}
here is the err im getting
04-09 20:08:22.069 377-455/system_process I/qtaguid: Failed write_ctrl(s 1 10021) res=-1 errno=1
04-09 20:08:22.069 377-455/system_process W/NetworkManagementSocketTagger: setKernelCountSet(10021, 1) failed with errno -1
04-09 20:08:22.109 563-563/com.android.launcher W/EGL_genymotion: eglSurfaceAttrib not implemented
04-09 20:08:22.109 563-563/com.android.launcher D/android.widget.GridLayout: horizontal constraints: x1-x0>=350, x2-x1>=390, x2-x0<=736 are inconsistent; permanently removing: x2-x0<=736.
04-09 20:08:22.109 563-563/com.android.launcher D/android.widget.GridLayout: horizontal constraints: x1-x0>=350, x2-x1>=390, x2-x0<=736 are inconsistent; permanently removing: x2-x0<=736.
04-09 20:08:22.109 563-563/com.android.launcher D/android.widget.GridLayout: horizontal constraints: x1-x0>=350, x2-x1>=390, x2-x0<=736 are inconsistent; permanently removing: x2-x0<=736.
04-09 20:08:22.137 563-563/com.android.launcher D/OpenGLRenderer: TextureCache::get: create texture(0xb8c4bde8): name, size, mSize = 1843, 128, 222912
04-09 20:08:22.137 563-563/com.android.launcher D/OpenGLRenderer: TextureCache::get: create texture(0xb8be3568): name, size, mSize = 1844, 256, 223168
04-09 20:08:22.137 563-563/com.android.launcher D/OpenGLRenderer: TextureCache::get: create texture(0xb8d454a0): name, size, mSize = 1845, 36864, 260032
04-09 20:08:22.141 563-563/com.android.launcher D/OpenGLRenderer: TextureCache::get: create texture(0xb8c0adb0): name, size, mSize = 1846, 36864, 296896
04-09 20:08:22.145 563-1502/com.android.launcher D/dalvikvm: GC_FOR_ALLOC freed 5859K, 42% free 15535K/26439K, paused 9ms, total 9ms
04-09 20:08:22.145 563-563/com.android.launcher D/OpenGLRenderer: TextureCache::get: create texture(0xb8c20d10): name, size, mSize = 1847, 36864, 333760
04-09 20:08:22.149 563-563/com.android.launcher D/OpenGLRenderer: TextureCache::get: create texture(0xb8b50810): name, size, mSize = 1848, 36864, 370624
04-09 20:08:22.149 563-563/com.android.launcher D/OpenGLRenderer: TextureCache::get: create texture(0xb8c3a700): name, size, mSize = 1849, 36864, 407488
04-09 20:08:22.189 563-1502/com.android.launcher D/dalvikvm: GC_FOR_ALLOC freed 771K, 39% free 16135K/26439K, paused 17ms, total 17ms
04-09 20:08:22.225 563-1502/com.android.launcher D/dalvikvm: GC_FOR_ALLOC freed 63K, 34% free 17679K/26439K, paused 9ms, total 9ms
04-09 20:08:22.349 563-1500/com.android.launcher D/dalvikvm: GC_FOR_ALLOC freed 1886K, 34% free 17480K/26439K, paused 5ms, total 5ms
04-09 20:08:22.381 563-565/com.android.launcher D/dalvikvm: GC_CONCURRENT freed 1370K, 32% free 18137K/26439K, paused 1ms+0ms, total 11ms
04-09 20:08:22.381 563-1500/com.android.launcher D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 6ms
04-09 20:08:22.385 563-637/com.android.launcher D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 10ms
04-09 20:08:22.401 563-565/com.android.launcher D/dalvikvm: GC_CONCURRENT freed 776K, 27% free 19370K/26439K, paused 1ms+0ms, total 8ms
04-09 20:08:22.405 563-637/com.android.launcher D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 11ms
04-09 20:08:22.613 377-455/system_process I/qtaguid: Failed write_ctrl(s 0 10049) res=-1 errno=1
04-09 20:08:22.625 377-455/system_process W/NetworkManagementSocketTagger: setKernelCountSet(10049, 0) failed with errno -1
04-09 20:08:23.669 5368-5368/? I/Process: Sending signal. PID: 5368 SIG: 9