Fetch
Fetch copied to clipboard
java.io.IOException: file_allocation_error
Hi,
I am getting the below error:
2021-05-07 18:33:02.996 11561-19062/com.kk.train E/LibGlobalFetchLib: FileDownloader download:DownloadInfo(id=2056976545, namespace='LibGlobalFetchLib', url='http://www.mydomain.com/mobileapp/update.apk', file='/storage/emulated/0/Android/data/com.kk.train/files', group=0, priority=HIGH, headers={clientKey=SD78DF93_3947&MVNGHE1WONG}, downloaded=0, total=6499986, status=QUEUED, error=NONE, networkType=ALL, created=1620392580162, tag=null, enqueueAction=UPDATE_ACCORDINGLY, identifier=0, downloadOnEnqueue=true, extras={}, autoRetryMaxAttempts=0, autoRetryAttempts=0, etaInMilliSeconds=-1, downloadedBytesPerSecond=-1) java.io.IOException: file_allocation_error at com.tonyodev.fetch2core.StorageResolverHelper.allocateFile(StorageResolverHelper.kt:264) at com.tonyodev.fetch2core.StorageResolverHelper.allocateFile(StorageResolverHelper.kt:232) at com.tonyodev.fetch2core.DefaultStorageResolver.preAllocateFile(DefaultStorageResolver.kt:57) at com.tonyodev.fetch2.downloader.SequentialFileDownloaderImpl.run(SequentialFileDownloaderImpl.kt:103) at com.tonyodev.fetch2.downloader.DownloadManagerImpl$start$$inlined$synchronized$lambda$1.run(DownloadManagerImpl.kt:103) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:923)
What could be wrong:
I have done the following: on click on update button I am calling this:
String url = "http://www.mydomain.com/mobileapp/update.apk";
String PATH = Objects.requireNonNull(getExternalFilesDir(null)).getAbsolutePath();
File file = new File(PATH);
boolean isCreate = file.mkdirs();
File outputFile = new File(file, "update.apk");
if (outputFile.exists()) {
boolean isDelete = outputFile.delete();
}
final Request request = new Request(url, file.getPath());
request.setPriority(Priority.HIGH);
request.setNetworkType(NetworkType.ALL);
request.addHeader("clientKey", "SD78DF93_3947&MVNGHE1WONG");
fetch.enqueue(request, new Func<Request>() {
@Override
public void call(@NotNull Request result) {
Toast.makeText(MainActivity.this, "Call is made", Toast.LENGTH_SHORT).show();
}
}, new Func<Error>() {
@Override
public void call(@NotNull Error result) {
Toast.makeText(MainActivity.this, "Error " + result.toString(), Toast.LENGTH_SHORT).show();
}
});
fetch.addListener(MainActivity.this);
What could be wrong? What am I missing?
same issue (java.io.IOException: file_allocation_error) from onError() callback method, any update on this? @tonyofrancis