오류 : 스타일 속성 'attr / colorPrimary'를 찾을 수 없습니다.

Aug 21 2020

최근에 새로운 Android 지침에 따라 대상 SDK를 29로 업데이트했지만 그 후에 다음 오류가 발생했습니다.

D : \ Android Apps \ PatherPane \ app \ src \ main \ res \ values ​​\ styles.xml : 4 : 5-9 : 13 : AAPT : 오류 : 스타일 속성 'attr / colorPrimary (일명 com.patherpane.app:attr/ colorPrimary) '를 찾을 수 없습니다.

내 스타일 XML 파일은 다음과 같습니다.

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

어떻게 해결할 수 있습니까?

이 명령 다음에 항목 이름이 표시되면 오류가 표시됩니다. Theme.AppCompat.Light.DarkActionBar

답변

5 bmalex Aug 22 2020 at 05:13

당신이 놓친 적이 없어요 확인 APPCOMPAT 에서 구현 build.gradle (응용 프로그램)을

implementation ‘com.android.support:appcompat-v7:28.0.0’

또는

implementation 'androidx.appcompat:appcompat:1.2.0'

androidx를 사용하는 경우

4 AdhiamboOyier Aug 26 2020 at 17:20

이 오류는 일반적으로 다음과 같은 경우에 나타납니다.

androidx.appcompat:appcompat

com.google.android.material:material

버전이 일치하지 않습니다. 하나만 업데이트했는지 확인하십시오.