我刚刚让我的谷歌地图应用程序在启动时没有崩溃,但现在,当它打开时,它只显示灰色/白色背景和缩放按钮。我搜索了网页,发现这可能是我的API密钥的问题,所以我从谷歌获得了一个新密钥,但这也没有用。
以下是它的外观截图。 link to image(我是新用户,因此我无法在此处发布图片)
这是我的清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androidbasic12"
android:versionCode="1"
android:versionName="1.0"
>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<permission
android:name="come.example.androidbasics12.permission.MAPS_RECIEVE"
android:protectionLevel="signature"/>
<uses-permission
android:name="com.example.androidbasics12.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"/>
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/new_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<!-- First xml to be loaded -->
<activity
android:name="com.example.androidbasic12.MainActivity"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Opens main menu after splash has loaded -->
<activity
android:name=".myMenu"
android:label="@string/app_name"
android:screenOrientation="portrait"> >
<intent-filter>
<action android:name="com.example.androidbasic12.CLEARSCREEN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- Opens test -->
<activity
android:name=".tutOne"
android:label="@string/app_name"
android:screenOrientation="portrait"> >
<intent-filter>
<action android:name="com.example.androidbasic12.TUTONE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- Opens map page -->
<activity
android:name=".map"
android:label="@string/app_name"
android:screenOrientation="portrait"> >
<intent-filter>
<action android:name="com.example.androidbasic12.MAPS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBcMOBc8WVLUIRUfs0Zgap3cnhwm4dWLag"/>
</application>
</manifest>
有人对此有任何提示吗?
答案 0 :(得分:1)
我遇到了和你一样的问题,一切都在模拟器上运行正常,但在真实设备上它是带有缩放按钮的灰色表面。 然后我尝试了其他设备,它的工作原理。所有其他手机都有原始(库存)固件,只有我有一个自定义固件。
租赁首先检查模拟器上的一切正常,然后检查设备上是否有库存固件,并告诉我们结果。
答案 1 :(得分:0)
问题可能不在于您的API密钥,而在API控制台中的授权应用程序。确保使用Google API控制台注册了正确的密钥和软件包名称。具体来说,如果您正在直接从eclipse编译和启动,那么您可能正在登录debug mode。如果是这样,您需要将调试密钥哈希+包名称添加到API控制台中允许的应用程序。