LogCat消息:找不到Google Play服务资源。检查项目配置以确保包含资源

本文讨论了在使用Google Maps Android v2 API时遇到的LogCat错误消息——'找不到Google Play服务资源'。尽管应用似乎能正常工作,但作者探讨了可能的原因,包括SDK更新、位置服务设置、项目配置等,并分享了解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文翻译自:LogCat message: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included

I have an application that uses the Google Maps Android v2 API. 我有一个使用Google Maps Android v2 API的应用程序。 I've added the google-play-services_lib library project to my workspace and added a reference to it from my application project, following the instructions on these pages: 我已将google-play-services_lib库项目添加到我的工作区,并根据这些页面上的说明从我的应用程序项目中添加了对它的引用:

Everything seems to work fine: The app displays maps and overlays with the default markers. 一切似乎都运行正常:应用程序使用默认标记显示地图和叠加层。 So I'm pretty sure I've got the Google Play services and Google Maps API stuff set up correctly. 所以我很确定我已经正确设置了Google Play服务和Google Maps API。

However, I see this message in the ADT LogCat window whenever the map view is initialized (on a 2nd-gen Nexus 7): 但是,每当初始化地图视图时(在第二代Nexus 7上),我都会在ADT LogCat窗口中看到此消息:

The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

The message level is Error, and the tag is GooglePlayServicesUtil . 消息级别为Error,标记为GooglePlayServicesUtil

This seems benign, as my app does work fine. 这似乎是良性的,因为我的应用程序确实工作正常。 But what can I do or check to try to address whatever the problem might be? 但我该怎么做或检查以试图解决可能出现的问题?


Further info: Each time the "Google Play services resources were not found" message appears in LogCat, it is preceded by these messages, which are Warnings and tagged ResourceType : 更多信息:每次在LogCat中显示“未找到Google Play服务资源”消息时,都会显示这些消息,即警告和标记的ResourceType

getEntry failing because entryIndex 906 is beyond type entryCount 3

Failure getting entry for 0x7f0b038a (t=10 e=906) in package 0 (error -2147483647)

FWIW, I can't find the constant 0x7f0b038a anywhere when I search the projects, including the gen/R.java files. FWIW,我在搜索项目时找不到常量0x7f0b038a,包括gen / R.java文件。

I've checked the contents of the generated .apk, and it includes all of the resources that are in the google-play-services_lib/res directory. 我已经检查了生成的.apk的内容,它包含了google-play-services_lib/res目录中的所有google-play-services_lib/res


Another update: After adding ActionBarSherlock and updating the targetSdkVersion in my manifest from 8 to 17, I now see another error in the LogCat output: 另一个更新:添加ActionBarSherlock并将清单中的targetSdkVersion从8更新为17后,我现在看到LogCat输出中的另一个错误:

Could not find class 'maps.af.k', referenced from method 'maps.ag.an.a'

More details about that problem can be found here: Google Maps works fine on Android but I still get an error "Could not find class 'maps.i.k', referenced from method maps.z.ag.a" 关于这个问题的更多细节可以在这里找到: 谷歌地图在Android上工作正常,但我仍然收到错误“无法找到类'maps.i.k',从方法maps.z.ag.a引用”

And once again, the app seems to work just fine. 再一次,该应用程序似乎工作得很好。 Maybe it's safe to ignore these "errors"? 也许忽略这些“错误”是安全的吗?


#1楼

参考:https://stackoom.com/question/1DoTT/LogCat消息-找不到Google-Play服务资源-检查项目配置以确保包含资源


#2楼

You have to add the google-play-services-lib as a library-project. 您必须将google-play-services-lib为库项目。 They updated the SDK . 他们更新了SDK There are several tutorials around. 有几个教程。 For Eclipse it is easy: 对于Eclipse来说很简单:

Right click project -> properties -> Android

在此输入图像描述

For more detailed walkthroughs: 有关更详细的演练:

Importing the library-project 导入库项目

How to get GoogleMaps running on emulator 如何让GoogleMaps在模拟器上运行


#3楼

I just ran into this problem this morning and seemed very strange since my application was working fine up until today. 我今天早上遇到了这个问题,看起来很奇怪,因为我的应用程序工作正常,直到今天。 I was getting the exact same "The Google Play services resources were not found..." message. 我得到了完全相同的“未找到Google Play服务资源...”消息。

I tried opening the regular Google Maps application to see if I could get my location, but it wouldn't find it. 我尝试打开常规Google地图应用程序,看看我是否可以获取我的位置,但它找不到它。 Even after waiting 5 minutes, which is more than enough time to normally get a location from even the service provider via cell tower. 即使在等待5分钟之后,这也是通常从服务提供商通过手机信号塔获得位置的足够时间。 So I checked Location Services. 所以我检查了位置服务。

Anyway, the problem turned out to be that on my S3 under Location Services -> Google Location Services . 无论如何,问题原来是在我的S3下的位置服务 - > 谷歌位置服务 It was not checked. 它没有被检查。 The other two location options were checked ( VZW Location Services and Standalone GPS Services ), but the last one, Google Location Services was not. 检查了其他两个位置选项( VZW位置服务独立GPS服务 ),但最后一个,谷歌位置服务没有。 After turning that on, the regular Google Maps could find my location and my application could find my location and the problem went away. 打开后,常规Google地图可以找到我的位置,我的应用程序可以找到我的位置,问题就消失了。

The error message pops up due to: 由于以下原因弹出错误消息:

mMap.setMyLocationEnabled(true);

when Google Location Services is not enabled. 何时未启用Google位置服务。

After doing some more testing it looks like if the current location is null (cannot be determined from all sources) then you will get this error when trying to turn on setMyLocationEnabled. 在进行一些更多测试后,看起来如果当前位置为空(无法从所有源确定),那么在尝试打开setMyLocationEnabled时会出现此错误。


#4楼

I had the same issue here. 我在这里遇到了同样的问题。 As Magnus said above, for me it was happening due to an SDK update to version 22.0.5. 正如Magnus上面所说,对我来说,由于版本22.0.5的SDK更新而发生了这种情况。

After performing a full update in my Android SDK (including Google Play Services) and Android plugins in Eclipse , I was able to use play services lib in my application. 在我的Android SDK (包括Google Play服务)和Eclipse中的 Android插件中执行完整更新后,我能够在我的应用程序中使用播放服务lib。


#5楼

I also had the same problem. 我也有同样的问题。 In starting, it was working fine then, but sometime later I uninstalled my application completely from my device (I was running it on my mobile) and ran it again, and it shows me the same error. 在开始时,它工作正常,但不久之后我完全从我的设备上卸载了我的应用程序(我在我的手机上运行它)并再次运行它,它显示了同样的错误。

I had all lib and resources included as it was working, but still I was getting this error so I removed all references and lib from my project build, updated google service play to revision 10, uninstalled application completely from the device and then again added all resources and libs and ran it and it started working again. 我已经包含了所有的lib和资源,因为它正在工作,但我仍然收到此错误,所以我从我的项目构建中删除了所有引用和lib,更新了google服务播放到修订版10,从设备中完全卸载了应用程序然后再次添加了所有资源和库并运行它,它又开始工作了。

One thing to note here is while running I am still seeing this error message in my LogCat , but on my device it is working fine now. 这里要注意的一件事是在运行时我仍然在我的LogCat中看到此错误消息,但在我的设备上它现在正常工作。


#6楼

I had the same issue. 我遇到过同样的问题。 In the Google APIs Console, you should check that there is only one key generated for that app. 在Google API控制台中,您应该检查是否只为该应用生成了一个密钥。 I had a stretch where I migrated my code from one PC to the next and so on (it got messy), and had multiple keys for my one project. 我有一段时间将我的代码从一台PC迁移到另一台PC等等(它变得凌乱),并为我的一个项目提供了多个密钥。 The older keys are all listed as inactive on the API console page, but for some reason caused a conflict. 旧的密钥在API控制台页面上都列为非活动状态,但由于某种原因导致冲突。 After deleting them completely, I ran it again and it worked. 完全删除后,我再次运行它,它的工作原理。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值