错误 - 导入 google 播放服务

Error - Importing google play service

我正在学习android,我想使用google播放服务进行定位服务。

我正在关注:http://www.androidhive.info/2015/02/android-location-api-using-google-play-services/

我有这个例子要求的导入库google-play-service_lib。但是 res/values-v21 和 res/values-v11 中显示以下错误 如果有人知道这一点,请帮忙。谢谢。

错误 1

Description : error: Error retrieving parent for item: No resource found that matches the given name `'@android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar'.`

Resource : appinvite_styles.xml
Path : /google-play-services_lib/res/values-v21 
Location : line 5   
Type : Android AAPT Problem

错误 2

Description : error: Error retrieving parent for item: No resource found that matches the given name `'@android:style/Theme.Holo.Light.DialogWhenLarge.NoActionBar'.`

Resource : appinvite_styles.xml 
Path : /google-play-services_lib/res/values-v11 
Location : line 5   
Type : Android AAPT Problem

这是我的文件res/values-v11

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <!-- Base preview application theme. -->
    <style name="Theme.AppInvite.Preview.Base" parent="@android:style/Theme.Holo.Light.DialogWhenLarge.NoActionBar"/>

</resources>

这是我的文件res/values-v21

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <!-- Base preview application theme. -->
    <style name="Theme.AppInvite.Preview.Base" parent="@android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar"/>

</resources>

您需要更改google播放服务目标

1) 右击google播放服务项目 2) Select 属性 3) 设定目标 21 希望对你有帮助

好吧,我终于找到了这个问题的解决方案。 它只需要导入 android-support-v7-appcompat 它给出错误的原因是它可能找不到 using as parent 的样式,

parent="@android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar"

parent="@android:style/Theme.Holo.Light.DialogWhenLarge.NoActionBar"

只是做,(文件 -> 导入 -> android sdk 的位置 -> sdk -> 额外 -> android -> 支持 -> v7 -> appcompat )

它对我有用,它可能不是这个错误的唯一原因,所以请阅读下面的评论(如果有的话)。 谢谢,希望对您有所帮助。