Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
357 views
in Technique[技术] by (71.8m points)

java - 'Failed to find style mapViewStyle' error persists

I've been working on this app for almost a year now (senior project) when it just decided to break a few days ago. My application has been developed using Eclipse version 3.7.2 64bit targeting Froyo Android 2.2, using my Windows 7 64bit pc. So far I have tried:

  • rearranging the uses-library tag in the manifest file
  • rewriting the map xml file
  • deleting the R.java file and refreshing
  • placing the mapview element within a layout
  • reinstalling eclipse and the android-sdk
  • cleaning the project
  • creating a style.xml file and referencing it
  • deploying on a actual device
  • reverting back to previous code

and possibly more...

My code is as follows: gmap.xml

<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="0xMbgnc-el963gCdpl547hdkgXUILTskZr-T5uvg" // random key posted here
/>

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.PubMe"
  android:versionCode="1"
  android:versionName="1.0">

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


<application android:icon="@drawable/icon" android:label="@string/app_name">
    <uses-library android:name="com.google.android.maps" />
    <activity android:name=".PubMeActivity"
              android:label="@string/app_name"
              android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".MappingActivity"
              android:label="@string/app_name">
    </activity>

</application>
</manifest>

I highly appreciate any help in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You must include /path_to_android-sdk/extras/google/google_play_services/libproject/google-play-services_lib Library as a external library into your project and also include this jar file /path_to_android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar.

beside those, you should have these permissions:

<uses-permission android:name="android.permission.INTERNET" /> **<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>** <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...