2011-12-14 21 views
7

Tôi gặp sự cố nhỏ với Ứng dụng bản đồ Android của tôi. Vì vậy, khi tôi thêm MapView vào tệp xml bố cục của mình, nó sẽ hiển thị cho tôi "Không thể tìm thấy phong cách 'mapViewStyle' trong chủ đề hiện tại" thông báo lỗi.Android - Không thể tìm thấy kiểu 'mapViewStyle' trong chủ đề hiện tại

Dưới đây là AndroidManifest.xml của tôi:

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

Và main.xml nơi mà thông báo lỗi xuất hiện:

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

Lưu ý: Tôi đã kiểm tra chính api Google Maps của tôi và không có vấn đề với Mã API.

Mọi đề xuất?

+0

bạn đã chọn mục tiêu xây dựng bao gồm GoogleApis chưa? –

+0

có, Google Apis - 10 (phiên bản 2.3.3) –

+0

bản sao có thể có của câu hỏi này: http://stackoverflow.com/questions/6975203/android-google-maps-failed-to-find-style-mapviewstyle-in- hiện tại-theme –

Trả lời

4

Bạn nói đúng, Rafael T, đó là một lỗi Eclipse ... Tôi đã giải quyết này sử dụng xây dựng Ant (thông qua thiết bị đầu cuối), và điều đó đã làm việc :) Cảm ơn một lần nữa ..

+0

bạn có bản phát hành nhật thực mới nhất không? –

+0

có, tôi đã thử nghiệm nó trên Indigo –

+0

Tôi đang trải nghiệm nó với Juno 4.3 .. Các công cụ nền tảng mới nhất ..: S – Ewoks

1

này xảy ra với tôi quá .. đi vào res> giá trị> styles.xml

loại bỏ các dòng chủ đề trước và đặt này một

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

trong việc tạo ra dự án, Eclipse hỏi để xác định một chủ đề cho ứng dụng. Bạn có thể đã chọn bất kỳ chủ đề Holo nào. Chủ đề này không hỗ trợ MapView đang hiển thị lỗi.

Các vấn đề liên quan