【发布时间】:2017-04-21 19:21:51
【问题描述】:
每次我开始一个新项目时都会出现这个错误 请任何人帮助我...... android studio中是否缺少某些东西
content_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.shareque.myapplication.MainActivity"
tools:showIn="@layout/app_bar_main">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
信息:Gradle 任务 [clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources] E:\myapps\BetaApps\Digitalworldapp\app\src\main\res\layout\content_main.xml 错误:(15, 49) 不允许使用字符串类型(在 'layout_constraintBottom_toBottomOf' 处,值为 'parent')。 错误:(16, 45) 不允许使用字符串类型(在 'layout_constraintLeft_toLeftOf' 处,值为 'parent')。 错误:(17, 47) 不允许使用字符串类型(在 'layout_constraintRight_toRightOf' 处,值为 'parent')。 错误:(18, 43) 不允许使用字符串类型(在 'layout_constraintTop_toTopOf' 处,值为 'parent')。 E:\myapps\BetaApps\Digitalworldapp\app\build\intermediates\res\merged\debug\layout\content_main.xml 错误:(15, 49) 不允许使用字符串类型(在 'layout_constraintBottom_toBottomOf' 处,值为 'parent')。 错误:(16, 45) 不允许使用字符串类型(在 'layout_constraintLeft_toLeftOf' 处,值为 'parent')。 错误:(17, 47) 不允许使用字符串类型(在 'layout_constraintRight_toRightOf' 处,值为 'parent')。 错误:(18, 43) 不允许使用字符串类型(在 'layout_constraintTop_toTopOf' 处,值为 'parent')。 错误:任务 ':app:processDebugResources' 执行失败。
com.android.ide.common.process.ProcessException:无法执行 aapt 信息:构建失败 信息:总时间:7.672 秒 信息:9 个错误 信息:0 个警告 信息:在控制台中查看完整的输出
【问题讨论】:
-
你是否包含了 ConstraintLayout 的依赖关系?
-
我也有同样的问题。您是否使用现有的 SDK 更改安装?
标签: android android-layout android-studio