简体   繁体   English

带有Google API的Android应用程序只能在模拟器上使用,而不能在手机上使用

[英]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.

相关问题 Android小部件在模拟器中运行良好,但在手机上它变成了Google App小部件 - Android widget works well in emulator but on phone it turns into the Google App widget Android应用程序可在模拟器上运行,但无法安装在我的手机上 - Android app works on emulator but will not install on my phone Android phonegap / cordova应用程序可在模拟器中使用,但不能在手机上使用 - Android phonegap/cordova app works in emulator but not on phone 这个Android应用程式无法在API 22模拟器中使用,但可以在API 16模拟器中使用 - this android app works in API 22 emulator not but in API 16 emulator Android应用程序可以在真实手机上运行,​​但不能在模拟器上运行-Android开发吗? - Android app works on real phone but not on the emulator - Android Development? 谷歌登录在模拟器中有效,但在手机中无效 - Google login works in emulator but not in phone Google Maps可以在手机上运行,​​而不是在模拟器上 - Google maps works on phone NOT on emulator APP可在模拟器中运行,但不能在真实手机中运行 - The APP works in emulator but not in real phone 从手机运行时,Android App崩溃,但在模拟器中工作正常 - Android App crashes when run from phone but works fine in emulator Android Gridview可以在模拟器上运行,但不能在手机上运行! - Android Gridview works on Emulator but no the Phone!
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM