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

前端 未结 1 1871
生来不讨喜
生来不讨喜 2020-12-17 23:28

i am new to android studio i am doing one sample application in android studio, when i run the application 5.0 it\'s working fine but 5.0 below it\'s thro

相关标签:
1条回答
  • 2020-12-17 23:49

    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

    0 讨论(0)
提交回复
热议问题