Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AppCompatDelegate Failed to instantiate custom view inflater android.support.v7.app.AppCompatViewInflater

When Getting Release apk am getting this error log in all activities of the app

04-03 17:10:54.105 26527-26527/? I/AppCompatDelegate: Failed to instantiate custom view inflater android.support.v7.app.AppCompatViewInflater. Falling back to default.
            java.lang.ClassNotFoundException: android.support.v7.app.AppCompatViewInflater
              at java.lang.Class.classForName(Native Method)
              at java.lang.Class.forName(Class.java:309)
              at java.lang.Class.forName(Class.java:273)
              at android.support.v7.app.j.b(AppCompatDelegateImplV9.java:1014)
              at android.support.v7.app.j.onCreateView(AppCompatDelegateImplV9.java:1092)
              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:482)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
              at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3605)
              at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3677)
              at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1943)
              at android.support.v7.app.j.x(AppCompatDelegateImplV9.java:374)
              at android.support.v7.app.j.w(AppCompatDelegateImplV9.java:323)
              at android.support.v7.app.j.b(AppCompatDelegateImplV9.java:284)
              at android.support.v7.app.c.setContentView(AppCompatActivity.java:139)
              at com.myapp.example.MainActivity.I(MainActivity.java:1523)
              at com.myapp.example.MainActivity.onCreate(MainActivity.java:358)
              at android.app.Activity.performCreate(Activity.java:6010)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2413)
              at android.app.ActivityThread.access$800(ActivityThread.java:155)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:135)
              at android.app.ActivityThread.main(ActivityThread.java:5343)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
            Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.app.AppCompatViewInflater" on path: DexPathList[[zip file "/data/app/com.myapp.example-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
              at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
              at java.lang.Class.classForName(Native Method) 
              at java.lang.Class.forName(Class.java:309) 
              at java.lang.Class.forName(Class.java:273) 
              at android.support.v7.app.j.b(AppCompatDelegateImplV9.java:1014) 
              at android.support.v7.app.j.onCreateView(AppCompatDelegateImplV9.java:1092) 
              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725) 
              at android.view.LayoutInflater.inflate(LayoutInflater.java:482) 
              at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
              at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
              at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3605) 
              at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3677) 
              at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1943) 
              at android.support.v7.app.j.x(AppCompatDelegateImplV9.java:374) 
              at android.support.v7.app.j.w(AppCompatDelegateImplV9.java:323) 
              at android.support.v7.app.j.b(AppCompatDelegateImplV9.java:284) 
              at android.support.v7.app.c.setContentView(AppCompatActivity.java:139) 
              at com.myapp.example.MainActivity.I(MainActivity.java:1523) 
              at com.myapp.example.MainActivity.onCreate(MainActivity.java:358) 
              at android.app.Activity.performCreate(Activity.java:6010) 
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129) 
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292) 
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2413) 
              at android.app.ActivityThread.access$800(ActivityThread.java:155) 
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317) 
              at android.os.Handler.dispatchMessage(Handler.java:102) 
              at android.os.Looper.loop(Looper.java:135) 
              at android.app.ActivityThread.main(ActivityThread.java:5343) 
              at java.lang.reflect.Method.invoke(Native Method) 
              at java.lang.reflect.Method.invoke(Method.java:372) 
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) 
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700) 
            Suppressed: java.lang.ClassNotFoundException: android.support.v7.app.AppCompatViewInflater
              at java.lang.Class.classForName(Native Method)
              at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
              at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                  ... 32 more
            Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

App Gradle Configuration is given below:

  • compileSdkVersion 27,
  • buildToolsVersion "25.0.3"
  • minSdkVersion 16,
  • targetSdkVersion 24
  • support_library_version = '27.1.0',
  • google_play_services_version = '12.0.1'**

Note: Am getting this error only in release build & not in debug build.

Thank you.

like image 821
Sarath Kumar Avatar asked Apr 03 '18 12:04

Sarath Kumar


2 Answers

Write Pro Guard Rules :

-dontwarn android.support.v7.** -keep class android.support.v7.** { *; } -keep interface android.support.v7.** { *; }

like image 169
Sameer Jani Avatar answered Nov 02 '22 04:11

Sameer Jani


It looks like this is a bug with appcompat-v7 27.1.0: https://issuetracker.google.com/issues/74289571

Mar 27, 2018 07:49AM

The development team has fixed the issue that you have reported and it will be available in a future build.

You can either update to a newer version of the support libraries (if this fix has already been released), or downgrade to the previous version where this bug was not present: 27.0.2.

like image 20
Thorbear Avatar answered Nov 02 '22 04:11

Thorbear