본문 바로가기
JAVA

【에러 해결】 aapt: error: attribute android:hinttextcolor not found.

by 윈투 2022. 5. 2.

 

에러가 발생시 해결 방법을 공유합니다.

 

aapt: error: attribute android:hinttextcolor not found. android studio java

 

 

ERROR: C:/Users/Luciana/AndroidStudioProjects\Intentocalculadora/app/src/main/res/layout/activity_main.xml :34: AAPT: error: attribute android:hintTextColor not found.

Source: https://www.holadevs.com/pregunta/110228/error-attribute-androidhinttextcolor-not-found

 

 

1. android:textColorHint 로 교체해서 해결

 

 

아래 에러 사례는 스택오버 플로우의 내용을 참고했습니다. 아래와 같은 코드를 사용했을 때 attribute android:hintTextColor not found 관련 에러가 계속 발생했습니다.

 

<EditText
        android:id="@+id/editTextTextPassword"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="249dp"
        android:autofillHints=""
        android:ems="10"
        android:hint="@string/password_msg"
        android:hintTextColor="#757575"
        android:inputType="textPassword"
        android:minHeight="48dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

 

해결책은 아래 코드를

 

android:hintTextColor="#757575"

 

아래 코드로 수정해 주는 것입니다.

 

android:textColorHint="#757575"

 

 

 

 

2. android: 삽입으로 해결

 

아래와 같은 에러 메시지가 발생했습니다.

error: style attribute 'attr/colorBackground (aka jp.aftech.myapplication:attr/colorBackground)' not found.
Message{kind=ERROR, text=error: style attribute 'attr/colorBackground (aka jp.aftech.myapplication:attr/colorBackground)' not found., sources=[/Users/shoichi/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/2d3e2ed35fddb328f4a6d0df363c67ad/res/values/values.xml], original message=, tool name=Optional.of(AAPT)}

 

 

설정 화면을 만들다가 잘 안 되어서 삭제를 하고 앞에 만들던 곳으로 되돌렸는데 에러가 발생해서 고생을 했습니다.

 

결론 부터 말씀드리면 android:를 styles.xml의 colorBackground 앞에 삽입하는 것으로 해결할 수 있었습니다.

 

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="android:colorBackground">@color/colorBackground</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

</resources>

 

 

댓글