Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Failed to find style 'mapViewStyle' in current theme

I've a little problem with my Android Maps Application. So that when I added MapView to my layout xml file it shows me "Failed to find style 'mapViewStyle' in current theme" error message.

Here's my AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.acilSRV.client"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="10" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">

    <uses-library android:name="com.google.android.maps"/>
        <activity android:name=".AcilActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

</manifest>

And main.xml where that error message appears:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    />

   <com.google.android.maps.MapView
    android:id="@+id/myMapView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:enabled="true"
    android:clickable="true"
    android:apiKey="*******"
  />

</LinearLayout>

Note: I have already checked my Google Maps api key and there's no problem with api key.

Any suggestions?

like image 485
Zaur Guliyev Avatar asked Dec 14 '11 23:12

Zaur Guliyev


2 Answers

You were right, Rafael T, that's an Eclipse bug...I have solved this using Ant builder (through terminal), and that worked :) Thanks again..

like image 71
Zaur Guliyev Avatar answered Nov 05 '22 12:11

Zaur Guliyev


This happened to me too.. go into res>values>styles.xml

remove the previous theme line and put this one

<style name="AppBaseTheme" parent="android:Theme.Light" />

During the project creation, Eclipse asks to define a theme for the application. You might have selected any Holo theme. This theme doesn't support MapView which is showing the error.

like image 35
Rohan Kandwal Avatar answered Nov 05 '22 14:11

Rohan Kandwal