FileDownloader
FileDownloader copied to clipboard
Crash
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.
I think the error log is specific enough to tell you how to do.
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();
}
}
Two questions:
- Do you invoke FileDownloader method in some methods before Application#onCreate? Such as
attachBaseContext
method. - If you don't use MultiDex, wether the problem will dismiss or not?