App crashing on Android API less than 5.0(lollipop)

前端 未结 4 1275
一整个雨季
一整个雨季 2021-01-12 23:38

The problem I am facing is that my android application works well on devices having API 5.0 and above but crashes on devices having Kitkat(4.4) and its corresponding lower v

4条回答
  •  走了就别回头了
    2021-01-12 23:48

    When you are using multidex , then try to extend your application class with MultiDexAppication instead of Application and override below method this required for Android below 5.0 (because 5.0 and above support to the multidex)

       @Override
        protected void attachBaseContext(Context base)
        {
            super.attachBaseContext(base);
            MultiDex.install(BaseApplication.this);
        }
    

    and in dependencies add this

    compile 'com.android.support:multidex:1.0.1'

提交回复
热议问题