Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 当使用栓系设备进行调试时,我应该使用哪个Google Maps API密钥?_Android_Google Maps_Google Maps Api 3_Api Key - Fatal编程技术网

Android 当使用栓系设备进行调试时,我应该使用哪个Google Maps API密钥?

Android 当使用栓系设备进行调试时,我应该使用哪个Google Maps API密钥?,android,google-maps,google-maps-api-3,api-key,Android,Google Maps,Google Maps Api 3,Api Key,我知道关于使用GoogleMapsAPI密钥有很多问题,但自从V1灭绝以来,这些问题都没有得到回答。在MapView上加载地图分幅时遇到问题。我正在使用一个从调试密钥库派生的API密钥,并且正在使用通过USB连接的Nexus7进行调试。我相信我在某个地方读到,如果您使用USB调试,调试密钥将无法工作-这是真的吗?如果我无法让虚拟设备在我的机器上运行,我该如何解决这个问题?MapView显示得很好,但我得到了“Server returns 3”错误,我知道这与密钥不匹配有关。以下是我的布局文件中的

我知道关于使用GoogleMapsAPI密钥有很多问题,但自从V1灭绝以来,这些问题都没有得到回答。在MapView上加载地图分幅时遇到问题。我正在使用一个从调试密钥库派生的API密钥,并且正在使用通过USB连接的Nexus7进行调试。我相信我在某个地方读到,如果您使用USB调试,调试密钥将无法工作-这是真的吗?如果我无法让虚拟设备在我的机器上运行,我该如何解决这个问题?MapView显示得很好,但我得到了“Server returns 3”错误,我知道这与密钥不匹配有关。以下是我的布局文件中的视图以及我的手册:

<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"
/>

清单

<?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>


在启用调试的情况下使用调试键没有问题。这可能是由于清单中缺少uses library语句造成的。但是我真的建议从V1升级到当前版本-在那里密钥更容易处理(您只需要将密钥和appname放入网站,而不是xml中即可)。

感谢您的回答-如果我不清楚,很抱歉,我实际上在这里使用的是V2。我需要另一个图书馆吗?我已经在里面了。我很高兴您向我指出了这个方向,不过,我注意到我忘记了用我自己的包名替换MAPS_RECEIVE Permissions的示例包名。如果您在v2上,那么您不需要xml布局中的键—它在清单中的元数据标记中出现一次。