-
Notifications
You must be signed in to change notification settings - Fork 18
Issues on Startup
Alex Gilleran edited this page Mar 15, 2015
·
2 revisions
This is adapted from the bug report kindly sent in by Darko Grozdanovski in Issue 14. Basically, within Android AsyncTasks have to be generated on the UI thread, and somehow this isn't always guaranteed even though it should be - see the Android issue page. This should be fixed for most still-used versions of Android now, but will still affect at least 2.2 and 2.3.
In your class extending Application, in the onCreate method, include this code:
Class.forName("android.os.AsyncTask");
e.g.
public class App extends Application {
...
@Override
public void onCreate() {
super.onCreate();
try {
// A bug in the async task, happens if the async task is initialized for the first time from a non-ui thread
Class.forName("android.os.AsyncTask");
} catch (Exception e) {
Logger.d(TAG, "", e);
}
}
...
}