Android - App crashes on Pre-Lollipop devices

前端 未结 4 1299
栀梦
栀梦 2021-02-05 21:23

My app is running well on Lollipop devices but it keep crashing on prior to version Lollipop. I have simply implemented a banner add in my application with the following code th

4条回答
  •  灰色年华
    2021-02-05 21:37

    After expanding more than a hour on problem, I found that I have to do some modification in MyApplication Class like this:

    public class MyApplication extends Application {
    
        @Override
        public void onCreate() {
            super.onCreate();
            // register with Active Android
            ActiveAndroid.initialize(this);
        }
    
        @Override
        protected void attachBaseContext(Context base) {
            super.attachBaseContext(base);
            MultiDex.install(this);
        }
    }
    

    I have overriden the attachbaseContext method and all works fine now.

提交回复
热议问题