Balconsky
Balconsky

Reputation: 2244

Exception while trying use Google Map on Android

I am trying to use Google Map. So I got Android API key: enter image description here

I also turn on Google maps API V2:

enter image description here

In my AndroidManifest.xml I added:

 <meta-data
                android:name="com.google.android.maps.v2.API_KEY"
                android:value="AIzaSyAJR******************B2ur31EYL84"/> 

In layouts I add MapViews:

<com.google.android.gms.maps.MapView
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1.0"
    android:apiKey="AIzaSyAJR******************B2ur31EYL84"
    android:clickable="true"
    android:state_enabled="true" >
</com.google.android.gms.maps.MapView>

And another:

<com.google.android.gms.maps.MapView
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:apiKey="AIzaSyAJR******************B2ur31EYL84"
    android:clickable="true" />

AndroidManifest starts with:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.bssys"
    android:versionCode="1"
    android:versionName="1.1.1" >

My program packages almost all starts with com.bssys.android./**Class name or package **/ While my activity is starting I have exception:


Stack trace is too big. So I write it in separate file. https://dl.dropboxusercontent.com/u/77318984/stackTrace.txt

How I run program: I write it on Intellij Idea and run in debug mode. Use Android SDK version 4.4. Run on google nexus 7 (Android 4.4)

Upvotes: 0

Views: 97

Answers (2)

Nosk
Nosk

Reputation: 753

Well, when I used it I didn't put the apikey in the layout. I don't know if that can be a part of the error. Anyway, have you set your permissions properly ? I remember using these:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<permission android:name="com.bssys.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission>
<uses-permission android:name="com.bssys.permission.MAPS_RECEIVE"/>
<uses-feature android:required="true" android:glEsVersion="0x00020000"/>

Upvotes: 0

Morrison Chang
Morrison Chang

Reputation: 12121

You are using the wrong View class for Google Maps V2

com.google.android.maps.MapView

is the old V1 class.

It should be

com.google.android.gms.maps.MapView

Look at: Google Maps V2 MapView

It also looks like you didn't setup the correct meta data for your manifest file for V2 as well.

You might just want to review all of the changes that happened between Maps V1 and V2 as it requires some rework of code and isn't just a simple drop in.

Upvotes: 2

Related Questions