我实现谷歌地图Android版。我创建了一个测试应用程序,并插入到该应用程序的所有的权限等,并应用完美地工作。
I am implementing google maps for android. I created a test application and inserted all the permissions etc in that application and the application worked flawlessly.
但是,当我试图复制相同的code到我的实际应用它显示我对Android activity.Although我在谷歌API控制台。
But when I try and copy the same code to my real application it shows me blank screen on the android activity.Although I've updated the package name in the google api console
.
下面是我的测试项目清单如下:
Here's what my Test Project Manifest Looks Like :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapstutorial"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission
android:name="com.example.mapstutorial.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.mapstutorial.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<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" >
<uses-library android:name="com.google.android.maps" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="my api key"/>
<activity
android:name="com.example.mapstutorial.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>
</manifest>
和这里就是我真正的项目清单如下:
and here's what my real project manifest looks like :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shop.shoppinglist"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
<permission android:name="com.shop.addtask.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<permission android:name="com.shop.shoppinglist.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.shop.addtask.permission.MAPS_RECEIVE"/>
<uses-permission android:name="com.shop.shoppinglist.permission.C2D_MESSAGE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:allowBackup="true"
android:theme="@style/AppTheme" >
<uses-library android:name="com.google.android.maps"/>
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="my api key"/>
<activity
android:name=".Login_Activity"
android:label="@string/title_activity_main"
android:theme="@style/Theme.Sherlock"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
我更新包的名称以 com.shop.addtask
在我的控制台指纹,但它仍然让我看到白色screen.What可能会导致这个问题?该 apikey
我用的是在这两个应用程序一样。但是,它适用于测试应用程序
不在真正的应用程序
。
I updated the package name to com.shop.addtask
in my console fingerprint but still it shows me the white screen.What could cause the problem ? The apikey
I've used is same in both of the applications. But it works on test application
not on the real app
.
在
谷歌地图Android的V2控制台
在我使用中提到的控制台相同的API密钥。
I've created the api key using the fingerprint
I've switched on
google maps android v2 in the console
I am using the same api key as mentioned in the console.
所以,这些事情是正确的,这个问题不能由其中一人引起的。
So these things are correct and the problem cannot be caused by one of them.
2可能的原因:
1 这部分:
<uses-library android:name="com.google.android.maps"/>
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="my api key"/>
应该结束申请前右
标记。
2 最有可能的,你有你的钥匙某种问题。尝试生成一个新的通过删除 debug.keystore
文件夹,然后运行项目。然后通过控制台重新注册。
2. Most likely you have some sort of problem with your key. Try to generate a new by deleting the debug.keystore
folder and running a project. then register it again via the console.
您可以使用本指南我写来做到这一点:
you can use this guide I wrote to do just that:
谷歌地图API V2关键
更新:
选中此为第二个:
<permission android:name="com.shop.addtask.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
看起来您在此处设置的包是不是你的应用程序的软件包,应该是:
it looks that the package you set here is not the package of your application and should be:
<uses-permission android:name="com.shop.shoppinglist.permission.MAPS_RECEIVE"/>
<permission android:name="com.shop.shoppinglist.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>