【问题标题】:InflateException after upgrade to android studio 3.0 & 3.1升级到 android studio 3.0 和 3.1 后出现 InflateException
【发布时间】:2017-11-30 08:22:42
【问题描述】:

我正在使用ExpandableLayout 库,它工作得很好,但是在升级到 gradle 3.0 后,我遇到了这个错误:

android.view.InflateException: Binary XML file line #2: Error inflating class com.andexert.expandablelayout.library.ExpandableLayoutItem ... Caused by: java.lang.reflect.InvocationTargetException ... Caused by: java.lang.IllegalArgumentException: Header

上线:

View root = inflater.inflate(R.layout.item, null);

还有我的item.xml

<?xml version="1.0" encoding="utf-8"?>
<com.andexert.expandablelayout.library.ExpandableLayoutItem
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/expandableLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:headerLayout="@layout/header"
    app:contentLayout="@layout/content"/>

【问题讨论】:

  • 你在你的 gradle 依赖中添加了compile com.github.traex.expandablelayout:library:1.3 吗?
  • 在你的堆栈跟踪中查看Caused by:
  • Caused by: java.lang.reflect.InvocationTargetExceptionCaused by: java.lang.IllegalArgumentException: Header
  • 那么 full 堆栈跟踪是什么?将其添加到您的问题中
  • @Anas,从 3.0 升级到 3.0.1 后,我遇到了和你一样的问题,我所有的包都没有解决,但有趣的是 gradle 正在构建没有错误。这似乎是一个错误

标签: android android-studio exception


【解决方案1】:

尝试使缓存无效,因为它可能已损坏。转到文件>使缓存无效/重新启动

【讨论】:

  • 你更新了平台工具和sdk构建工具吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-09-10
  • 2018-04-07
  • 1970-01-01
  • 1970-01-01
  • 2018-04-09
  • 1970-01-01
  • 2018-04-08
相关资源
最近更新 更多