개발/안드로이드

'Missing styles. Is the correct theme chosen for this layout?' 오류 수정하기

맨날치킨 2023. 2. 28. 09:05
반응형

Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.

Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.

 

아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.

Missing styles. Is the correct theme chosen for this layout?

스타일이 누락되었습니다. 이 레이아웃에 올바른 테마가 선택되었는지 확인했나요?

 문제 내용 

Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find style mapViewStyle in current theme.

스타일이 없습니다. 이 레이아웃에 대한 올바른 테마가 선택되었는지 확인하세요. 레이아웃 위의 테마 콤보 상자를 사용하여 다른 레이아웃을 선택하거나, 테마 스타일 참조를 수정하세요. 현재 테마에서 mapViewStyle 스타일을 찾을 수 없습니다.

 

I tried every solutions available to solve this problem but nothing seems to work. I have included library in the manifest file. I even created style is styles.xml, I have chosen Google Apis build target as well.

이 문제를 해결하기 위해 가능한 모든 해결책을 시도해봤지만, 아무것도 동작하지 않습니다. Manifest 파일에 라이브러리를 포함시켰고, styles.xml에 스타일도 생성했으며 Google Apis 빌드 타겟을 선택했습니다.

 

Can somebody please give me a solution?

누가 해결책을 알려주실 수 있나요?

 

here is my xml file:

제 XML 파일은 다음과 같습니다:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
style="@style/AppTheme"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >


 <com.google.android.maps.MapView
     android:id="@+id/themap"
     style="@style/mapViewStyle"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:apiKey="here i have my key"
     android:clickable="true"
     android:enabled="true" />

  </RelativeLayout>   

 

Here is my manifest snippet:

여기에 내 매니페스트 일부분이 있습니다:
  <uses-library android:name="com.google.android.maps" />

    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Second" />

    <activity android:name=".Third"  android:theme="@android:style/Theme.Black"/>
  </application>

 

here is my style.xml file

저의 style.xml 파일입니다.
<resources>
    <style name="mapViewStyle" parent="@android:style/Theme.Black">
    </style>
</resources>

 

 

 높은 점수를 받은 Solution 

For Android Studio (or IntelliJ IDEA),

안드로이드 스튜디오(또는 인텔리제이 IDEA)에서는,

 

If everything looks OK in your project and you're still receiving the error in your layouts, try to 'Invalidate caches & restart'.

만약 프로젝트에서 모든 것이 올바르게 보이지만 레이아웃에서 여전히 오류가 발생한다면 '캐시 무효화 및 재시작'을 시도해보세요. (Android Studio나 IntelliJ IDEA에서 지원하는 기능입니다.)

 

Enjoy a coffee while Android Studio is recreating caches & indexes.

안드로이드 스튜디오가 캐시와 인덱스를 다시 만드는 동안 커피 한 잔을 즐기세요.

 

how to invalidate cache & restart

 

 

 가장 최근 달린 Solution 

This is because you select not a theme of your project. Try to do next:

이는 프로젝트의 테마를 선택하지 않았기 때문입니다. 다음을 시도해보세요:

 

enter image description here

 

 

출처 : https://stackoverflow.com/questions/13439486/missing-styles-is-the-correct-theme-chosen-for-this-layout

반응형