0

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)

Ahmad Aghazadeh
  • 16,571
  • 12
  • 101
  • 98
Balconsky
  • 2,234
  • 3
  • 26
  • 39
  • you are using the old Google Maps which is no longer supported, you need to look at google maps v2 with google play services https://developers.google.com/maps/documentation/android/ – tyczj Dec 11 '13 at 15:47
  • @Balconsky - I would kill/delete app on device and try to rerun. -Edit: removed link to other SO question- – Morrison Chang Dec 11 '13 at 16:11
  • @Balconsky - I would also check that the device has a valid Internet connection [you probably have but just making sure] – Morrison Chang Dec 11 '13 at 16:14
  • Yea, I realy do not have internet connection. It is because I use vpn to connect to computer. I need both connections, for correct program work. – Balconsky Dec 11 '13 at 16:24

2 Answers2

2

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.

Community
  • 1
  • 1
Morrison Chang
  • 11,691
  • 3
  • 41
  • 77
0

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"/>
Nosk
  • 753
  • 2
  • 6
  • 24