【发布时间】:2017-07-19 00:25:35
【问题描述】:
我在使用 Android Studio 时遇到问题。我最近升级了我的 SDK 管理器以包含;
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta5'
类路径是
classpath 'com.android.tools.build:gradle:2.2.3'
项目构建良好。 Intellisense 和文档工作正常。但是当我尝试在我的手机上运行(调试)该应用程序时,我收到了这个错误;
Caused by: android.view.InflateException: Binary XML file line #2:
Binary XML file line #2: Error inflating class ConstraintLayout
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:443)
at android.app.Activity.setContentView(Activity.java:2172)
我已经同步了 gradle。我已经重新启动了 Android Studio。我已经清理并重建了项目。
关于如何解决这个问题的任何想法? 谢谢!
-编辑- XML 看起来像这样;
<ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/PLAY_PARENT"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/greenfelt2"
android:padding="0dp">
【问题讨论】:
-
添加您的 xml 代码。
标签: android android-studio android-constraintlayout