diff --git a/autosize/src/main/java/me/jessyan/autosize/InitProvider.java b/autosize/src/main/java/me/jessyan/autosize/InitProvider.java index 01024aa..f3dfaca 100644 --- a/autosize/src/main/java/me/jessyan/autosize/InitProvider.java +++ b/autosize/src/main/java/me/jessyan/autosize/InitProvider.java @@ -32,9 +32,13 @@ public class InitProvider extends ContentProvider { @Override public boolean onCreate() { + Context application = getContext().getApplicationContext(); + if (application == null) { + application = AutoSizeUtils.getApplicationByReflect(); + } AutoSizeConfig.getInstance() .setLog(true) - .init((Application) getContext().getApplicationContext()) + .init((Application) application) .setUseDeviceSize(false); return true; }