lingochamp/FileDownloader · error · IllegalAccessException

This value is used in the :filedownloader process, so set…

Error message

This value is used in the :filedownloader process, so set this value in your process is without effect. You can add 'process.non-separate=true' in 'filedownloader.properties' to share the main process to FileDownloadService. Or you can configure this value in 'filedownloader.properties' by 'download.min-progress-step'.

What it means

FileDownloadUtils.setMinProgressStep() only has effect inside the :filedownloader download process. Calling it from the main (non-downloader) process throws IllegalAccessException because the value would be ignored there anyway.

Solutions

  1. Set 'process.non-separate=true' in assets/filedownloader.properties so the downloader runs in the main process and the setter takes effect
  2. Configure the value statically in assets/filedownloader.properties via 'download.min-progress-step=<n>' instead of calling the setter
  3. Wrap the call in a check of FileDownloadUtils.isDownloaderProcess(context) and only set it when true

Example fix

// before
FileDownloadUtils.setMinProgressStep(8192);
// after
// assets/filedownloader.properties
download.min-progress-step=8192
Defensive patterns

Strategy: try-catch

Validate before calling

if (FileDownloadUtils.isDownloaderProcess(context)) {
    FileDownloadUtils.setMinProgressStep(8192);
}

Try / catch

try {
    FileDownloadUtils.setMinProgressStep(8192);
} catch (IllegalAccessException e) {
    // running in the main process; set download.min-progress-step in
    // filedownloader.properties instead
}

Prevention

When it happens

Trigger: Calling FileDownloadUtils.setMinProgressStep(int) in an app running in the default separate-process mode (process.non-separate not set to true), from any process other than the one hosting FileDownloadService.

Common situations: Configuring the downloader from Application.onCreate in the main process while downloads run in the separate :filedownloader process; forgetting the library defaults to a separate process.

Related errors


AI-assisted analysis of lingochamp/FileDownloader@6237a8cac1 (2026-09-08). Data as JSON: /api/errors/f6de25b5d7e937ef. Report an issue: GitHub.

Appendix: source

Thrown at library/src/main/java/com/liulishuo/filedownloader/util/FileDownloadUtils.java:83

     * @param minProgressStep The minimum bytes interval in per step to sync to the file and the
     *                        database.
     *                        <p>
     *                        Used for adjudging whether is time to sync the downloaded so far bytes
     *                        to database and make sure sync the downloaded buffer to local file.
     *                        <p/>
     *                        More smaller more frequently, then download more slowly, but will more
     *                        safer in scene of the process is killed unexpected.
     *                        <p/>
     *                        Default 65536, which follow the value in
     *                        com.android.providers.downloads.Constants.
     * @see com.liulishuo.filedownloader.download.DownloadStatusCallback#onProgress(long)
     * @see #setMinProgressTime(long)
     */
    public static void setMinProgressStep(int minProgressStep) throws IllegalAccessException {
        if (isDownloaderProcess(FileDownloadHelper.getAppContext())) {
            FileDownloadUtils.minProgressStep = minProgressStep;
        } else {
            throw new IllegalAccessException("This value is used in the :filedownloader process,"
                    + " so set this value in your process is without effect. You can add "
                    + "'process.non-separate=true' in 'filedownloader.properties' to share the main"
                    + " process to FileDownloadService. Or you can configure this value in "
                    + "'filedownloader.properties' by 'download.min-progress-step'.");
        }
    }

    /**
     * @param minProgressTime The minimum millisecond interval in per time to sync to the file and
     *                        the database.
     *                        <p>
     *                        Used for adjudging whether is time to sync the downloaded so far bytes
     *                        to database and make sure sync the downloaded buffer to local file.
     *                        <p/>
     *                        More smaller more frequently, then download more slowly, but will more
     *                        safer in scene of the process is killed unexpected.
     *                        <p/>
     *                        Default 2000, which follow the value in

View on GitHub (pinned to 6237a8cac1)