[英]Android app with Google API works on emulator but not on phone
I have an Android App that uses the Google API, displaying a map and some markers on this map. 我有一个使用Google API的Android应用,在该地图上显示地图和一些标记。 When I run the app on an emulator, the app works as expected, but when downloaded on an actual Andorid Phone it crashes.
当我在模拟器上运行该应用程序时,该应用程序可以按预期运行,但是在实际的Andorid Phone上下载时会崩溃。
The phone runs on Android 2.3.3, and the Google API version 15. I have put this line in the AndroidManifest.xml-file: 手机在Android 2.3.3和Google API版本15上运行。我将此行放在AndroidManifest.xml文件中:
<uses-sdk android:minSdkVersion="7" />
I have also signed the Google API key with the release keystore, and ensured that the same keystore was used when signing the application it self. 我还使用发布密钥库对Google API密钥进行了签名,并确保在对应用程序自身进行签名时使用了相同的密钥库。
As mentioned, when run on an emulator the app works fine, BUT i do get this error when the app is starting (after instalation): 如前所述,当在模拟器上运行时,应用程序运行良好,但是在应用程序启动时(安装后),确实会出现此错误:
MainActivity couldn't get connection factory client
And then there is a bunch of exeptions/warnings of this type: 然后是一堆这种类型的例外/警告:
System.err IOExeption processing: 26
System.err java.io.IOException: Server returned: 3
I'm new to Android programming, so I would appreciate any help that would solve this problem. 我是Android编程的新手,所以希望能为您解决这个问题提供帮助。
First check if appropriate permissions is set in AndroidManifest.xml. 首先检查是否在AndroidManifest.xml中设置了适当的权限。 Check if you have provided correct google map key.
检查您是否提供了正确的Google Map Key。 To create Key http://www.pocketvnc.com/blog/?page_id=511 Also try to generate new MAP key and use it instead of using the old one.
创建密钥http://www.pocketvnc.com/blog/?page_id=511还要尝试生成新的MAP密钥并使用它,而不要使用旧的MAP密钥。
For testing on real hardware you need to use a key different from the debug key. 要在真实硬件上进行测试,您需要使用与调试键不同的键。 Following your post you are using a debug keystore.
发布之后,您将使用调试密钥库。
https://developers.google.com/maps/documentation/android-api/v1/?csw=1#getfingerprint https://developers.google.com/maps/documentation/android-api/v1/?csw=1#getfingerprint
Read that paragraph on google. 在Google上阅读该段落。
Is important that the application is exported as a signed application with the same key used for the google api (and NOT the debug key). 将应用程序导出为具有与Google api相同的密钥(而不是调试密钥)的签名应用程序很重要。
For create a valid read that paragraph: 要创建有效的内容,请阅读该段落:
http://developer.android.com/guide/publishing/app-signing.html#releasemode http://developer.android.com/guide/publishing/app-signing.html#releasemode
and then use the same key to obtain the google maps api key. 然后使用相同的密钥获取Google Maps api密钥。
Once you have the key for your application you can export a signed application by clicking with right button of your mouse on the project select Android Tools and then Export as a signed application package and follow the wizard (probably you can create a new key using that wizard). 获得应用程序密钥后,可以通过在项目上用鼠标右键单击来选择一个已签名的应用程序,选择“ Android工具”,然后导出为一个已签名的应用程序包并按照向导进行操作(可能您可以使用该密钥创建一个新的密钥向导)。
hope that help. 希望对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.