在android中引入-google-places-api示例的问题
我正在尝试通过 Android 应用程序的 Google API 客户端使用 Google Places API。我找到了这个示例: http://ddewaele.blogspot .com/2011/05/introducing-google-places-api.html 并像 java 应用程序一样启动运行正常,所以我必须有一个正确的 API 密钥。 我正在使用 eclipse 和 maven,一切似乎都正常,但是当应用程序像 Android 应用程序一样启动时,模拟器运行正常,但显示以下错误: 应用程序应用程序名称 (com.ecs.googleplaces.sample.Main) 意外停止。请再试一次。 我已经看到了这个答案 创建 Google HTTP 传输对象对于 Android HTTP 请求,我已经编写了所有依赖项(还有更多,以及一些较新版本的依赖项) 我的 LogCat 中有一个粘贴:
06-17 13:58:40.442: ERROR/Zygote(33): setreuid() failed. errno: 2
06-17 13:58:51.091: ERROR/Zygote(33): setreuid() failed. errno: 17
06-17 13:58:52.272: ERROR/BatteryService(61): usbOnlinePath not found
06-17 13:58:52.272: ERROR/BatteryService(61): batteryVoltagePath not found
06-17 13:58:52.272: ERROR/BatteryService(61): batteryTemperaturePath not found
06-17 13:58:52.292: ERROR/SurfaceFlinger(61): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
06-17 13:58:52.402: ERROR/SensorService(61): couldn't open device for module sensors (Invalid argument)
06-17 13:58:57.061: ERROR/System(61): Failure starting core service
06-17 13:58:57.061: ERROR/System(61): java.lang.SecurityException
06-17 13:58:57.061: ERROR/System(61): at android.os.BinderProxy.transact(Native Method)
....
有人可以帮助我吗? 谢谢
I'm trying to use Google Places API through Google APIs Client for an Android app. I've found this example: http://ddewaele.blogspot.com/2011/05/introducing-google-places-api.html and launching like java application runs OK, so I must have a right API KEY.
I'm using eclipse and maven and all seems ok, but when the application is launched like Android app, the emulator runs ok but shows the following error:
The application Application Name (com.ecs.googleplaces.sample.Main) has stopped unexpectedly. Please try again.
I've seen that answer Creating a Google HTTP Transport Object for Android HTTP Request and I have all the dependencies there written (and more, and some of the with newer versions)
There is a paste from my LogCat:
06-17 13:58:40.442: ERROR/Zygote(33): setreuid() failed. errno: 2
06-17 13:58:51.091: ERROR/Zygote(33): setreuid() failed. errno: 17
06-17 13:58:52.272: ERROR/BatteryService(61): usbOnlinePath not found
06-17 13:58:52.272: ERROR/BatteryService(61): batteryVoltagePath not found
06-17 13:58:52.272: ERROR/BatteryService(61): batteryTemperaturePath not found
06-17 13:58:52.292: ERROR/SurfaceFlinger(61): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
06-17 13:58:52.402: ERROR/SensorService(61): couldn't open device for module sensors (Invalid argument)
06-17 13:58:57.061: ERROR/System(61): Failure starting core service
06-17 13:58:57.061: ERROR/System(61): java.lang.SecurityException
06-17 13:58:57.061: ERROR/System(61): at android.os.BinderProxy.transact(Native Method)
....
Can anyone help me?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Logcat 未显示与 Places API / API 密钥相关的任何内容。
该示例还应该可以在 Android 上几乎开箱即用。您唯一需要考虑的是 Android 上使用的 HTTP 传输。根据您的 API 级别,Google 建议使用特定的 HTTP 传输。
适用于 Java 的 Google API 客户端提供了一个实用方法,可根据您的 Android 运行时返回正确的 HttpTransport。
也许您还错过了 logcat 中的堆栈跟踪,其中包含崩溃的实际原因。尝试在 logcat 中搜索您的应用程序包。
The Logcat isn't showing anything related to the Places API / API key.
The sample should also work pretty much out of the box with Android. The only thing you need to consider is the HTTP Transport used on Android. Depending on your API level, Google recommends using specific HTTP transports.
The Google API client for Java offers a utility method to return the correct HttpTransport based on your Android runtime.
Perhaps you also missed a stacktrace in your logcat with the actual cause of the crash. Try searching for your application package in logcat.