开发者

MapView Class Not Found error.. Unsure why

I have a xml based Relative Layout and was attempting to add a small MapView to the layout, I obtained an API key (debug), Changed my platform target from Android 2.2 to the appropriate Google APIs platform, and then added the 'uses-library' code to manifest.

Finally adding in the xml to my relative layout:

<com.google.android.maps.MapView
        android:id="@+id/mapview"
        android:layout_below="@+id/txAddress"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:apiKey="@string/MAPS_API_KEY"
    /> 

I did expect this would be all I need, but when attempting to run (on my plugged in Desire HD) when I launch this activity I receive a class not found exception 开发者_StackOverflow社区for the MapView.

So not sure if the issue is related to my particular handset or version of google maps or something I've done wrong.. As this application is intended to eventually be released to the public if using MapViews can be unreliable, then I won't show it and instead have a button that launches the full google maps(if available).

Any thoughts appreciated.

Thanks,


Turns out the problem was the location of my 'uses-library' declaration in the manifest.

Usually I place all my uses-permissions etc underneath my activitiy declarations, once I'd moved the uses-library line above the activity declarations, then everything worked as expected.

One to watch out for !!!!!

Thanks guys for you input.


Not being flippant, but you did rebuild the apk after you changed the target platform and then run it on your device? Also, do you have the uses-permissions in your manifest also:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜