Shareque
Shareque

Reputation: 361

Each time when I start new Android studio project this error occurred

Each time when I start a new project this error occurred Please, anyone, help me...... is there something missing from the android studio

enter image description here

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>

Information:Gradle tasks [clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources] E:\myapps\BetaApps\Digitalworldapp\app\src\main\res\layout\content_main.xml Error:(15, 49) String types not allowed (at 'layout_constraintBottom_toBottomOf' with value 'parent'). Error:(16, 45) String types not allowed (at 'layout_constraintLeft_toLeftOf' with value 'parent'). Error:(17, 47) String types not allowed (at 'layout_constraintRight_toRightOf' with value 'parent'). Error:(18, 43) String types not allowed (at 'layout_constraintTop_toTopOf' with value 'parent'). E:\myapps\BetaApps\Digitalworldapp\app\build\intermediates\res\merged\debug\layout\content_main.xml Error:(15, 49) String types not allowed (at 'layout_constraintBottom_toBottomOf' with value 'parent'). Error:(16, 45) String types not allowed (at 'layout_constraintLeft_toLeftOf' with value 'parent'). Error:(17, 47) String types not allowed (at 'layout_constraintRight_toRightOf' with value 'parent'). Error:(18, 43) String types not allowed (at 'layout_constraintTop_toTopOf' with value 'parent'). Error:Execution failed for task ':app:processDebugResources'.

com.android.ide.common.process.ProcessException: Failed to execute aapt Information:BUILD FAILED Information:Total time: 7.672 secs Information:9 errors Information:0 warnings Information:See complete output in console

Upvotes: 0

Views: 2238

Answers (2)

Dawied
Dawied

Reputation: 1107

If you installed Android Studio and used an existing - and outdated - Android SDK installation (like I did recently), you may have to install the new ConstraintLayout library from the Support Repository. Afterwards you may need to adjust the used dependency in the app's build.gradle file (like you did).

From then on, when you start a new project using Android Studio, the right dependency will be included in the build.gradle.

Install ConstraintLayout for Android

Upvotes: 2

Shareque
Shareque

Reputation: 361

Problem solve after changing constraint-layout dependency from

compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha4'

to

 compile 'com.android.support.constraint:constraint-layout:1.0.1'

in app level Gradle file

Upvotes: 6

Related Questions