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

2

7

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.

Angevin answered 2/5, 2016 at 9:44 Comment(1)
try clean and sync project after run again.Tray
A
21

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'
Austerlitz answered 2/5, 2016 at 10:49 Comment(1)
Thanks a lot! I was digging trough similar problems all over SO and this solution is the only correct one for those using IntelliJ IDEA for Android development. I had this library at dependencies but had to change its version to the latest one.Barrows
D
2

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.

Darr answered 4/7, 2017 at 6:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.