I know there are a number of questions about using a Google Maps API key, but none of them have been answered since V1 went extinct. I am having trouble loading in the map tiles on my MapView. I am using an API key derived from the debug keystore and I am debugging using a Nexus 7 tethered via USB. Somewhere I believe I read that if you are using USB debugging, the debug key will not work - is this true? How do I work around this if I cannot get a virtual device to run on my machine? The MapView shows up fine, but I am getting the "Server returns 3" error, which I understand has to do with the key not matching. Here's the view in my layout file, as well as my manfiest:
<com.google.android.maps.MapView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:clickable="true"
android:apiKey="AIzaSyDXlQso2Xzo4vhLt3gqZAFuoYt081cao8M"
android:visibility="visible"
/>
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.casson.sherpy"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<permission
android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<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-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" android:permission="android.permission.ACCESS_FINE_LOCATION">
<uses-library android:name="com.google.android.maps" />
<activity
android:name="com.casson.sherpy.MainActivity"
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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDXlQso2Xzo4vhLt3gqZAFuoYt081cao8M"/>
</application>
</manifest>
There's no problem with using the debug key with debugging on. It may be due to your lack of a uses-library statement in your manifest. But I'd really suggest moving on from V1 to the current version- keys are much easier to deal with there (you just need to put the key and appname into a website, not in the xml at all).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.