如何解决布局activity_main未找到?

时间:2018-02-24 17:53:00

标签: android android-layout

C:\Users\acer\AndroidStudioProjects\MyApplication\app\src\main\res\layout\activity_main.xml
Error:error: attribute 'com.example.acer.myapplication:layout_constraintBottom_toBottomOf' not found.
Error:error: attribute 'com.example.acer.myapplication:layout_constraintLeft_toLeftOf' not found.
Error:error: attribute 'com.example.acer.myapplication:layout_constraintRight_toRightOf' not found.
Error:error: attribute 'com.example.acer.myapplication:layout_constraintTop_toTopOf' not found.
Error:attribute 'com.example.acer.myapplication:layout_constraintBottom_toBottomOf' not found.
Error:attribute 'com.example.acer.myapplication:layout_constraintLeft_toLeftOf' not found.
Error:attribute 'com.example.acer.myapplication:layout_constraintRight_toRightOf' not found.
Error:attribute 'com.example.acer.myapplication:layout_constraintTop_toTopOf' not found.
Error:failed linking file resources.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

1 个答案:

答案 0 :(得分:2)

确保在模块级build.gradle文件中声明了maven.google.com存储库:

repositories {
    maven {
        url 'https://maven.google.com'
    }
}

将库作为依赖项添加到同一build.gradle文件中:

dependencies {
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
}