Android Google Maps Failed to find style 'mapViewStyle' in current theme

When adding a google map view (I extended a MapView, used the xml editor to add it to the Activity, and added my google maps api key to the layout xml file manually)

My permissions allow Internet in the manifest file

What i'm wondering, is in the xml editor i get the error "Failed to find style 'mapViewStyle' in current theme" but i seem to have everything set up correctly.

Answers


I had the same problem when I try to build a simple app, following the Android MapView tutorial.

The app showed this exception in AVD for the file file main.xml:

Failed to find style 'mapViewStyle' in current theme

At last I found that there is a mistake in file AndroidManifest.xml:

The element <uses-library android:name="com.google.android.maps" /> should be a child of the <application> element, not immediately within <manifest>.

Hope this was any help to you.


For what its worth...

  1. My experience is that I got this in the UI Designer, but it did not break the build. I assume it is an Eclipse / Android SDK bug.

  2. My app has been working perfectly on the store until I upgraded my SDK to version 20. It leads me to believe this is something to do with the SDK.

  3. Of the various answers to this question (and duplicates) I found, none of them helped:

    • not changing the target SDK

    • not clean & build

    • not declaring a style manually


Finally, these questions are all duplicates (and mostly useless as confirmed by Ewok):

I tried to point this out to the moderators but I was ignored...


I had the same issue when creating a Google Map view that worked well until I cleaned the project after placing a new icon.png in a drawable folder (Project >> Clean). Many times the cleaning process will install an import statement at the top program code, which overrides the R.java file in your project. The solution was to simply remove the following import statement:

import android.R

after the project was saved and rebuilt without issue.


I was having the same problem, and it turned out the problem was I had targeted the app towards the Google 4.0 APIs, but in the Manifest file specified Android API 10 (2.3.3).

Once I changed the project's target from 4.0 to 2.3.3 (API 10), it worked better.


My answer may be a late one, but i hope that it'll deals with the actual reason and sure it could be helpful for those who are going to search about the same problem in future.

This type of errors,

1. Android Google Maps Failed to find style 'mapViewStyle' in current theme
2. Failed to find style 'imageButtonStyle' in current theme 
3. Failed to find style 'editTextStyle' in current theme 
4. Failed to find style 'textViewStyle' in current theme 

Anything from the above list it may be,

The ultimate reason is ,

We have selected the unavailable Theme for the layout.

This may cause because of,

  1. The selected theme is not available in themes.xml file.
  2. The selected theme is belongs to higher version sdk, but our current target sdk is lower one.

This problem mostly happens,

  1. when you copy the whole layout file and try to implement it in your project. a. Your may forgot to copy themes.xml file b. You may have lower target sdk, the original layout created with higher target sdk.

The Solutions for this problem are,

(Open and View the layout file in the Graphical Layout View, and look at the top Right corner. There your themes for the layout have been selected.)

  1. So click the dropdown list for theme selection and choose the available themes according to your project themes and targeted sdk themes. (OR)
  2. If the theme is a custom one , if you are required it , then copy the themes.xml file to your project from the source where you copied the layout xml file. (OR)
  3. If the theme is sdk avail theme, if you are required it , then change your target according to your selected theme.

Hope,This might be helpful for somebody.


This is how I solved this problem. I had in my application google maps too, and I change:

c:\users\manuel\.Android\debug.keystore

with new created key (new key didn't work) and error was:

Failed to find style 'mapViewStyle' in current theme

after returning old key everithing worked fine. I really hate developing for android it's mess comparing to Visual studio development. this problem cost me 4h ...

To re-create debug.keystore use this "Debug certificate expired" error in Eclipse Android plugins


Need Your Help

How can we create a generic Array Extension that sums Number types in Swift?

swift

Swift lets you create an Array extension that sums Integer's with:

PHP - remove <img> tag from string

php string

Hey, I need to delete all images from a string and I just can't find the right way to do it.