FileDownloader icon indicating copy to clipboard operation
FileDownloader copied to clipboard

Crash

Open AhmadullahSaikat opened this issue 4 years ago • 3 comments

 Caused by: java.lang.IllegalStateException: Please invoke the 'FileDownloader#setup' before using FileDownloader. If you want to register some components on FileDownloader please invoke the 'FileDownloader#setupOnApplicationOnCreate' on the 'Application#onCreate' first.

AhmadullahSaikat avatar Sep 28 '19 10:09 AhmadullahSaikat

I think the error log is specific enough to tell you how to do.

rantianhua avatar Sep 29 '19 06:09 rantianhua

No, It's crash for Android 9, not for previous versions.

My code is here:

public class MyApp extends MultiDexApplication {

    @Override
    public void onCreate() {
        super.onCreate();
        setupFileDowmloader();
    }

    private void setupFileDowmloader() {
        FileDownloader.setupOnApplicationOnCreate(this)
                .connectionCreator(new FileDownloadUrlConnection
                        .Creator(new FileDownloadUrlConnection.Configuration()
                        .connectTimeout(15_000) // set connection timeout.
                        .readTimeout(15_000) // set read timeout.
                ))
                .commit();
    }

}

AhmadullahSaikat avatar Sep 29 '19 13:09 AhmadullahSaikat

Two questions:

  1. Do you invoke FileDownloader method in some methods before Application#onCreate? Such as attachBaseContext method.
  2. If you don't use MultiDex, wether the problem will dismiss or not?

rantianhua avatar Sep 30 '19 02:09 rantianhua