java.lang.NoClassDefFoundError: android.support.v4.view.LayoutInflaterCompatHC in Android Studio

旧街凉风 提交于 2019-11-29 06:48:33

It looks like you have enabled multidex, but you are not using the multidex library.

Lollipop (API 21) introduced native support for multidexing, but for previous versions of Android you must use the multidex support library to properly support multidexing.

First, add the dependency to your build.gradle:

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

Second, you need to enable multidex in your application code. If you are not using a custom Application class already, you can do so by registering the MultiDexApplication class in your manifest like so:

<application
    ...
    android:name="android.support.multidex.MultiDexApplication">
    ...
</application>

If you are using a custom application class, you should enable multidex in attachBaseContext() like so:

@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);

    MultiDex.install(this);
}

Source: Building Apps with over 65k Methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!