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.

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.

Can somebody please give me a solution?

here is my xml file:

<?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

<resources>
    <style name="mapViewStyle" parent="@android:style/Theme.Black">
    </style>
</resources>

Solution 1:

For Android Studio (or IntelliJ IDEA),

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

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

how to invalidate cache & restart

Solution 2:

I had the same problem and found it was the Theme dropdown at the top of the graphical layout editor. I changed from Holo to Theme and the layout displayed and error disappeared.

Solution 3:

What I usually do is the following: a Gradle Clean, Rebuild and Sync all my Gradle files. After that I restart Android Studio, and I go to:

Select Theme -> Project Themes -> AppTheme

Solution 4:

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

enter image description here

Solution 5:

If we are creating too many projects using Android Studio sometime Rendering issue comes. Even creating a blank activity we receive such rendering error. Please shut down and restart Android studio. In case the issue persists you can Android Studio Cache Invalidation and Restart

Hope this helps. It works similar fashion as rule of thumb, in case all looks good and still error persists a restart of application usually resolves the issue.