Issue
So I have generated my API key by getting my MD5 certificate fingerprint from my debug store using this command in the terminal...
keytool -list -alias androiddebugkey -keystore <my_debug.keystore_location> -storepass android -keypass android
This is generated fine and I then go online enter it into the text box, hit generate and get my api key which I then enter into my xml layout like so..
<com.google.android.maps.MapView
android:id="@+id/map_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:state_enabled="true"
android:clickable="true"
android:apiKey="my_api_key/>
Then in my AndroidManifest.xml I have added the permission for internet before the Application tag and inside the applicate tag I have put the library reference.
<uses-permission android:name="android.permissions.INTERNET"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:hardwareAccelerated="true" >
<uses-library android:name="com.google.android.maps"/>
<activity
android:name=".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>
</application>
My AVD is the correct api target as well as my project. The MapView is displaying but only with the grey tiles. I also have internet in the emulator as I checked using the browser.
Any help would be much appreciated.
EDIT
Ok looking in my LogCat it says
Couldn't get connection factory client
So I'm guessing thats what the problem is?
Prior to this appearing in the LogCat it also says
Handling Network change notification:CONNECTED
Solution
Finally I found the problem. Yet another ridiculously simple solution that I should have spotted. If you look at the code below which is taken from my original question, you may be able to spot the mistake.
<uses-permission android:name="android.permissions.INTERNET"/>
Got it? android.permissions.INTERNET should be android.permission.INTERNET. That's right... SINGULAR.
After this, it still didn't work. However after deleting my debug.keystore and debug.keyset from my .android folder and then restarting eclipse and doing a fresh install to regenerate them, I then got a new API key and hey presto, it worked.
I hope this helps someone else and these stupid mistakes can be avoided.
I have also written a walkthrough on how to get the Google Maps API working that should help you out.
Answered By - StuStirling
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.