Issue
TL;DR
We need to move
<uses-permission android:name="android.permission.INTERNET"/>
under
</application>
Original question
Hi, I am a newbie in android development. I tried the "Hello Google Maps" tutorial and I am not able to view the map. I signed up for API key. I am using Eclipe which is installed in on the "D" drive. Used following command to obtain MD5 fingerprint from the bin folder of my jdk installation:
c:\program files\java\jdk 1.6\bin> keytool -list -alias androiddebugkey -keystore "C:\Documents and Settings\Owner\.android\debug.keystore" -storepass android -keypass android
I got this fingerprint
21:17:B1:D8:01:BD:F2:5A:9F:C9:A3:01:96:FA:9A:5B
Used this to find the API key and got this
"0Gm7C3R3R2K1pmQGuGkS0rx582TWJEBdJwryFrA"
Used the following code in layout
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0Gm7C3R3R2K1pmQGuGkS0rx582TWJEBdJwryFrA"
/>
Still map is not displayed. Please enlighten me on this. Thanks in advance
LogCat Error log
11-25 03:14:38.432: ERROR/AndroidRuntime(10857): ERROR: thread attach failed
11-25 03:14:42.162: ERROR/AndroidRuntime(10866): ERROR: thread attach failed
11-25 03:14:45.562: ERROR/AndroidRuntime(10877): ERROR: thread attach failed
11-25 03:14:47.402: ERROR/MapActivity(10885): Couldn't get connection factory client
11-25 03:14:50.652: ERROR/PackageInstallationReceiver(6465): Remove /data/local/tmp/com.testGoogleMap.apk Fail!
11-25 03:14:58.952: ERROR/wpa_supplicant(1683): wpa_supplicant_ctrl_iface_ap_scan: 2
11-25 03:14:58.952: ERROR/wpa_supplicant(1683): Scan request
11-25 03:14:59.802: ERROR/wpa_supplicant(1683): wpa_supplicant_ctrl_iface_ap_scan: 1
My manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.helloGoogleMaps"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
<uses-permission android:name="android.permission.ACCESS_INTERNET"/>
<uses-library android:name="com.google.android.maps"/>
<activity android:name=".HelloGoogleMaps"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="7" />
</manifest>
Modified manifest
<?xml version="1.0" encoding="utf-8"?>
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
<uses-library android:name="com.google.android.maps"/>
<activity android:name=".HelloGoogleMaps"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-sdk android:minSdkVersion="7" />
Solution
It seems to be a problem of some permissions in your manifest, here is a working example of an AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifest package="<your package>"
android:versionCode="1"
android:versionName="1.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="3" />
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:debuggable="true">
<activity android:name="<package>.Activity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" ></uses-library>
</application>
</manifest>
Look into your manifest and check if :
- the
INTERNET
permission is there - the
uses-library
is there
Answered By - Dr1Ku
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.