-->

MapActivity cannot be resolved to a type

2020-08-17 00:43发布

问题:

I'm busy trying to get the MapView included in my Android project. I'm following the MapView tutorial on the Android developer website but I'm getting an error:

'MapActivity cannot be resolved to a type'

I tried pressing Ctrl+Shift+O to auto import all classes but it's not helping. When I try to include the Maps libary manually it gives this error:

'The import com.google.android cannot be resolved'

I have added the following line (see below) to the Manifest and my target is API 7 (Platform: 2.1).

<uses-library android:name="com.google.android.maps" />

What am I doing wrong?

Thanks!!!

回答1:

Google API is a third party SDK. Choose third party in packages manager.



回答2:

You need to reference correct library at compile time. But what you describe is asking Android to use this specific library at runtime.

You need to right click your Eclipse project, Properties -> Android. In Project Build Target select any target with vendor Google Inc..