Search code examples
androidlocationgoogle-geolocation

Error - Importing google play service


I'm learning android, I want to use google play service for location service.

I am following : http://www.androidhive.info/2015/02/android-location-api-using-google-play-services/

I had import library google-play-service_lib as this example asks for. But the following error shows in res/values-v21 & res/values-v11 please help if anyone knows this. Thank you.

Error-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

Error-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

Here's my file 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>

Here's my file 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>

Solution

  • Okay, finally i found the solution of this. it just need to import the android-support-v7-appcompat the reason why it gives error is it may not find the style using as parent ,

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

    just do , (File -> Import -> Location of android sdk -> sdk -> extras -> android -> support -> v7 -> appcompat)

    it works for me , it may possible that it is not the only reason of this error so please read comments below if any. thank you , hope it helps.