Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClassNotFoundException: Didn't find class "android.support.design.widget.AppBarLayout"

I'm using AppBarLayout and NestedScrollview in my code .But I get a error. The code compile successfully but crash with the stacktrace

05-02 17:10:17.255 31335 31335 E AndroidRuntime: FATAL EXCEPTION: main
05-02 17:10:17.255 31335 31335 E AndroidRuntime: Process: com.android.settings, PID: 31335
05-02 17:10:17.255 31335 31335 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{XXXXXXXXXXXXXXXXXXX}: android.view.InflateException: Binary XML file line #14: Binary XML file line #14: Error inflating class android.support.design.widget.AppBarLayout
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2423)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.app.ActivityThread.access$900(ActivityThread.java:153)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:148)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:5438)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:736)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-02 17:10:17.255 31335 31335 E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #14: Binary XML file line #14: Error inflating class android.support.design.widget.AppBarLayout
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.view.LayoutInflater.inflate(LayoutInflater.java:543)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.app.Activity.setContentView(Activity.java:2183)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.app.Activity.performCreate(Activity.java:6303)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    ... 9 more
05-02 17:10:17.255 31335 31335 E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #14: Error inflating class android.support.design.widget.AppBarLayout
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.view.LayoutInflater.rInflate(LayoutInflater.java:839)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.view.LayoutInflater.inflate(LayoutInflater.java:519)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    ... 18 more
05-02 17:10:17.255 31335 31335 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.AppBarLayout" on path: DexPathList[[zip file "/system/framework/cloud-common.jar", zip file "/system/framework/zxing.jar", zip file "/system/framework/android-support-v13.jar", zip file "/system/framework/protobuf.jar", zip file "/system/priv-app/Settings/Settings.apk"],nativeLibraryDirectories=[/system/priv-app/Settings/lib/arm, /vendor/lib, /system/lib]]
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.view.LayoutInflater.createView(LayoutInflater.java:587)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:768)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    ... 22 more
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    Suppressed: java.lang.ClassNotFoundException: android.support.design.widget.AppBarLayout
05-02 17:10:17.255 31335 31335 E AndroidRuntime:        at java.lang.Class.classForName(Native Method)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
05-02 17:10:17.255 31335 31335 E AndroidRuntime:        ... 25 more
05-02 17:10:17.255 31335 31335 E AndroidRuntime:    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

I develop with intellij .thanks for any suggestion.

like image 730
user6280532 Avatar asked May 02 '16 09:05

user6280532


2 Answers

Check if you have included Google Design Support Library in your project. You can include it in your app level Gradle file like this -

compile 'com.android.support:design:23.3.0'
like image 163
jaibatrik Avatar answered Dec 04 '22 08:12

jaibatrik


also check your target sdk version before add any support library in gradel

for example:

if target sdk = 25

then your support library will be com.android.support:design:25.4.0 or it may we between minSdkVersion and targetSdkVersion.

like image 35
rakesh rajput Avatar answered Dec 04 '22 09:12

rakesh rajput