【问题标题】:ClassNotFoundException when I use design support library当我使用设计支持库时出现 ClassNotFoundException
【发布时间】:2015-06-06 09:44:25
【问题描述】:

当我使用设计支持库时,我的应用程序崩溃了。 Logcat显示如下:

android.view.InflateException: Binary XML file line #12: Error inflating class com.android.design.support.FloatingActionButton

java.lang.ClassNotFoundException:在路径上找不到类“com.android.design.support.FloatingActionButton”:DexPathList[[zip file“/data/app/com.example.lmy86263.designsupportlibrarydemo-1/base .apk"],

我将 com.android.support:design:22.2.0 添加到 gradle 并同步,但它不起作用。

有什么解决办法吗?

【问题讨论】:

  • 你是通过sdk manager下载的支持库吗?
  • 是的,Android 支持库 22.2
  • 在您的 xml 中,FloatingActionButton 应该是这样的----> <android.support.design.widget.FloatingActionButton,我认为您在布局文件中错误地添加了它。你也可以发布布局文件吗?

标签: android material-design floating-action-button androiddesignsupport


【解决方案1】:

在你的 xml 中 FloatingActionButton 应该是这样的----> <android.support.design.widget.FloatingActionButton, 您在布局文件中错误地添加了它,因此您收到错误消息。

例如:

 <android.support.design.widget.FloatingActionButton
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    app:layout_anchor="@id/appbar"
    app:layout_anchorGravity="bottom|right|end"
    android:src="@drawable/ic_discuss"
    android:clickable="true"/>

【讨论】:

    猜你喜欢
    • 2015-08-13
    • 1970-01-01
    • 2015-02-13
    • 1970-01-01
    • 1970-01-01
    • 2017-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多