1

I'm trying to setup google map for android. I'm seeing the two zoom buttons but no map is getting displayed. I've been struggling hard for last 6-7 hours. Earlier it was showing error (wasn't opening up) & now it's not showing the map.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.counz.app"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="16" />

<permission
    android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />

<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />

<uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.counz.app.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="(mykey)" />
</application>

Edit: This is the LogCat error

  03-09 23:15:47.210: W/KeyCharacterMap(14440): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
03-09 23:16:24.740: W/dalvikvm(14545): VFY: unable to resolve instance field 23
03-09 23:16:25.540: W/dalvikvm(14545): Unable to resolve superclass of Lmaps/p/s; (427)
03-09 23:16:25.540: W/dalvikvm(14545): Link of class 'Lmaps/p/s;' failed
03-09 23:16:25.540: W/dalvikvm(14545): Unable to resolve superclass of Lmaps/y/bo; (3820)
03-09 23:16:25.540: W/dalvikvm(14545): Link of class 'Lmaps/y/bo;' failed
03-09 23:16:25.540: W/dalvikvm(14545): Unable to resolve superclass of Lmaps/i/k; (4208)
03-09 23:16:25.540: W/dalvikvm(14545): Link of class 'Lmaps/i/k;' failed
03-09 23:16:25.540: E/dalvikvm(14545): Could not find class 'maps.i.k', referenced from method maps.z.ag.a
03-09 23:16:25.540: W/dalvikvm(14545): VFY: unable to resolve new-instance 3540 (Lmaps/i/k;) in Lmaps/z/ag;
03-09 23:16:29.020: I/ActivityThread(14545): queueIdle
03-09 23:16:29.060: V/ActivityThread(14545): Reporting idle of ActivityRecord{4a4a9288 token=android.os.BinderProxy@4a4a8df8 {com.counz.app/com.counz.app.MainActivity}} finished=false
03-09 23:16:29.060: W/ActivityNative(14545): send ACTIVITY_IDLE_TRANSACTION
03-09 23:16:29.750: E/Google Maps Android API(14545): Authorization failure.
03-09 23:16:58.600: I/ActivityThread(14545): queueIdle
03-09 23:16:58.600: V/ActivityThread(14545): Reporting idle of ActivityRecord{4a4a9288 token=android.os.BinderProxy@4a4a8df8 {com.counz.app/com.counz.app.MainActivity}} finished=false
03-09 23:16:58.600: W/ActivityNative(14545): send ACTIVITY_IDLE_TRANSACTION

Thanks. :)

Shivam Mangla
  • 92
  • 6
  • 16

2 Answers2

2

You doing the referencing the wrong way, please take a look at this short 8 steps guide that i wrote to get a Google map in your application, please follow the steps precisely and you will have a Google map at the end.

I was creating a Google map application when i was writing this guide and you can see the end result at it end.

Creating Google Map API V2

Emil Adz
  • 40,709
  • 36
  • 140
  • 187
  • Okay. I followed this tutorial. I'm not getting any error now but not getting the map either. – Shivam Mangla Mar 09 '13 at 16:05
  • Getting zoom in & zoom out buttons though. – Shivam Mangla Mar 09 '13 at 16:09
  • Yes. I thought so & have tried to generate a new key. But it generated the same key again. Will it generate the same debug key even for different app names (package names) ? – Shivam Mangla Mar 09 '13 at 16:18
  • i had the same problem and i posted a question here: http://stackoverflow.com/questions/14465794/blank-map-with-zoom-controls-on-using-google-maps-api-v2-fragment-map you can see that at the end I have found out that i turned the wrong api on the API Console. try to follow this: https://blog-emildesign.rhcloud.com/?p=403 in creating you key. please accept my answer if it helped you to fix your problem. – Emil Adz Mar 09 '13 at 16:21
  • I've provided the package name there in the android key generator. – Shivam Mangla Mar 09 '13 at 17:41
  • are u positive that you set Google Maps Android API V2 and not Google Maps API V2 in the console? – Emil Adz Mar 09 '13 at 17:41
  • you need to provider the package name in the console and not in the key generator... – Emil Adz Mar 09 '13 at 17:43
  • Okay. I've edited my question. Please see the new error I'm getting. You are very helpful dude. – Shivam Mangla Mar 09 '13 at 17:55
  • @ShivamMangla, please don't reedit, you question with all around another question, but open a new post with the new question. 2 reasons: take in mind that in the future this post could be read by other people that will not understand the connection between the given answers and the newly edited question and second: you will have a better chance on getting the answer from all people here as they see it as a new question and not only from me. – Emil Adz Mar 09 '13 at 18:02
  • Ok, So please open another question and i will try to help you there, but for me it's still looks like a key problem. I ask again: are u positive that you set Google Maps Android API V2 and not Google Maps API V2 in the console? – Emil Adz Mar 09 '13 at 18:18
1

Acrivity have to extends FragmentActivity for proper fragment inflating. Please, check if MainActivity extends FragmentActivity. Remember that if you write app for older versions of Android you have to use support library v4 and SupportMapFragment instead of MapFragment.

Btw. referencing android library in eclipse doesn't change AndroidManifest.xml, only project.properties. You have to add manually lines like this

<activity android:name="com.example.android.tictactoe.library.GameActivity" />

only if you use some Activity from library. In case of google maps v2 you only need MapFragment so you don't have to do that.

Leszek
  • 6,568
  • 3
  • 42
  • 53