java.lang.NoClassDefFoundError: android.support.v4.view.LayoutInflaterCompatHC in Android Studio
java.lang.NoClassDefFoundError: android.support.v4.view.LayoutInflaterCompatHC in Android Studio
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 throw's this Execption can any one tel what i am wrong here...
08-25 18:17:40.354 28953-28953/com.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: android.support.v4.view.LayoutInflaterCompatHC
at android.support.v4.view.LayoutInflaterCompat$LayoutInflaterCompatImplV11.setFactory(LayoutInflaterCompat.java:42)
at android.support.v4.view.LayoutInflaterCompat.setFactory(LayoutInflaterCompat.java:79)
at android.support.v7.app.AppCompatDelegateImplV7.installViewFactory(AppCompatDelegateImplV7.java:812)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:57)
at com.app.utils.UIHelper.onCreate(UIHelper.java:28)
at com.app.DashboardActivity.onCreate(DashboardActivity.java:97)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
at android.app.ActivityThread.access0(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4448)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
at dalvik.system.NativeStart.main(Native Method)
build.gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
applicationId "com.app"
multiDexEnabled = true
}
buildTypes {
debug {
minifyEnabled false
debuggable true
}
}
lintOptions {
abortOnError false
}
packagingOptions{
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.api-client:google-api-client:1.20.0'
compile 'com.google.api-client:google-api-client-android:1.20.0'
compile 'com.google.api-client:google-api-client-gson:1.20.0'
compile 'com.google.apis:google-api-services-calendar:v3-rev125-1.20.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.google.android.gms:play-services:7.8.0'
}
您似乎启用了 multidex,但您没有使用 multidex 库。
Lollipop (API 21) 引入了对 multidexing 的原生支持,但对于以前的版本 Android 您必须使用 multidex 支持库才能正确支持 multidexing。
首先,将依赖项添加到您的 build.gradle:
compile 'com.android.support:multidex:1.0.0'
其次,您需要在应用程序代码中启用 multidex。如果您 没有 使用自定义 Application
class ,您可以通过在清单中注册 MultiDexApplication
class 来实现,例如所以:
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
如果您正在使用自定义应用程序class,您应该在attachBaseContext()
中启用multidex,如下所示:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
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 throw's this Execption can any one tel what i am wrong here...
08-25 18:17:40.354 28953-28953/com.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: android.support.v4.view.LayoutInflaterCompatHC
at android.support.v4.view.LayoutInflaterCompat$LayoutInflaterCompatImplV11.setFactory(LayoutInflaterCompat.java:42)
at android.support.v4.view.LayoutInflaterCompat.setFactory(LayoutInflaterCompat.java:79)
at android.support.v7.app.AppCompatDelegateImplV7.installViewFactory(AppCompatDelegateImplV7.java:812)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:57)
at com.app.utils.UIHelper.onCreate(UIHelper.java:28)
at com.app.DashboardActivity.onCreate(DashboardActivity.java:97)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
at android.app.ActivityThread.access0(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4448)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
at dalvik.system.NativeStart.main(Native Method)
build.gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
applicationId "com.app"
multiDexEnabled = true
}
buildTypes {
debug {
minifyEnabled false
debuggable true
}
}
lintOptions {
abortOnError false
}
packagingOptions{
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.api-client:google-api-client:1.20.0'
compile 'com.google.api-client:google-api-client-android:1.20.0'
compile 'com.google.api-client:google-api-client-gson:1.20.0'
compile 'com.google.apis:google-api-services-calendar:v3-rev125-1.20.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.google.android.gms:play-services:7.8.0'
}
您似乎启用了 multidex,但您没有使用 multidex 库。
Lollipop (API 21) 引入了对 multidexing 的原生支持,但对于以前的版本 Android 您必须使用 multidex 支持库才能正确支持 multidexing。
首先,将依赖项添加到您的 build.gradle:
compile 'com.android.support:multidex:1.0.0'
其次,您需要在应用程序代码中启用 multidex。如果您 没有 使用自定义 Application
class ,您可以通过在清单中注册 MultiDexApplication
class 来实现,例如所以:
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
如果您正在使用自定义应用程序class,您应该在attachBaseContext()
中启用multidex,如下所示:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}