【问题标题】:Android - Failed to find style 'mapViewStyle' in current themeAndroid - 在当前主题中找不到样式“mapViewStyle”
【发布时间】:2012-01-20 17:55:26
【问题描述】:

我的 Android 地图应用程序有点问题。因此,当我将 MapView 添加到我的布局 xml 文件时,它会显示“无法在当前主题中找到样式 'mapViewStyle'”错误消息。

这是我的 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>

以及出现该错误消息的 main.xml:

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

注意:我已经检查了我的 Google Maps api key,api key 没有问题。

有什么建议吗?

【问题讨论】:

  • 您是否选择了包含 GoogleApis 的构建目标?
  • 是的,Google API - 10(2.3.3 版本)
  • 这个问题的可能镜像:stackoverflow.com/questions/6975203/…
  • 我已经尝试了所有仍然出现错误的解决方案...
  • 尝试用 ant 构建以清除是否是 Eclipse 错误

标签: android google-maps


【解决方案1】:

你是对的,Rafael T,这是一个 Eclipse 错误...我已经使用 Ant builder(通过终端)解决了这个问题,并且成功了 :) 再次感谢..

【讨论】:

  • 你有最新的eclipse-release吗?
  • 我正在体验 Juno 4.3 .. 最新平台工具.. :S
【解决方案2】:

这也发生在我身上。进入 res>values>styles.xml

删除之前的主题行并放入这一行

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

在项目创建期间,Eclipse 要求为应用程序定义一个主题。您可能选择了任何 Holo 主题。此主题不支持显示错误的 MapView。

【讨论】:

    猜你喜欢
    • 2011-11-14
    • 2012-03-16
    • 2011-10-21
    • 1970-01-01
    • 2012-05-25
    • 1970-01-01
    • 1970-01-01
    • 2015-01-15
    • 2018-12-05
    相关资源
    最近更新 更多