2

This question have been asked many more times, and i have tried almost all the solutions given there but nothing worked in my case. This is my xml

<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"
/>

this is my java code

public class Storesearch extends FragmentActivity{
  private GoogleMap map; 
  private LocationManager locationManager;
  private Location mylocation;
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_storesearch);
    determineLocation();
  }

  protected void onStart() {
       super.onStart();
       setupMap();
       appMapSettings();
       spotCurrentLocation(mylocation);
  }

  public void setupMap(){
   if(map==null){
     SupportMapFragment mf=(SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map);   
      map=mf.getMap();

   }

  }

This is my manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.fyp.searchstore"
    android:versionCode="1"
    android:versionName="1.0" >
    <permission
        android:name="com.fyp.searchstore.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.fyp.searchstore.permission.MAPS_RECEIVE" />


    <meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="API KEY"/>

     <meta-data
            android:name="com.google.android.gms.version"
            android:value="19" />

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="19" />

     <uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".Storesearch"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

    </manifest>

and finally my logcat report

10-17 04:45:12.664: D/AndroidRuntime(2461): Shutting down VM
10-17 04:45:12.664: W/dalvikvm(2461): threadid=1: thread exiting with uncaught exception (group=0xb2ad1ba8)
10-17 04:45:12.684: E/AndroidRuntime(2461): FATAL EXCEPTION: main
10-17 04:45:12.684: E/AndroidRuntime(2461): Process: com.fyp.searchstore, PID: 2461
10-17 04:45:12.684: E/AndroidRuntime(2461): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fyp.searchstore/com.fyp.searchstore.Storesearch}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
10-17 04:45:12.684: E/AndroidRuntime(2461):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
10-17 04:45:12.684: E/AndroidRuntime(2461):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
10-17 04:45:12.684: E/AndroidRuntime(2461):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
10-17 04:45:12.684: E/AndroidRuntime(2461):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
10-17 04:45:12.684: E/AndroidRuntime(2461):     at android.os.Handler.dispatchMessage(Handler.java:102)
10-17 04:45:12.684: E/AndroidRuntime(2461):     at android.os.Looper.loop(Looper.java:136)
10-17 04:45:12.684: E/AndroidRuntime(2461):     at android.app.ActivityThread.main(ActivityThread.java:5017)
10-17 04:45:12.684: E/AndroidRuntime(2461):     at java.lang.reflect.Method.invokeNative(Native Method)
10-17 04:45:12.684: E/AndroidRuntime(2461):     at java.lang.reflect.Method.invoke(Method.java:515)
10-17 04:45:12.684: E/AndroidRuntime(2461):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)

its giving me error on second line of xml file. i m using revision20 of google play services while my android API is version 19. Does the problem i m having is due to these versions? Thanks in advance

shifa fatima
  • 63
  • 1
  • 3
  • 10

2 Answers2

0

Look like this guy had the same problem than you: Stackoverflow
Look to the second answer. Did you copy the .jar file or did you add it as a referenced library ?

And had you download the Android Support Library ?

Community
  • 1
  • 1
Allan Mermod
  • 806
  • 1
  • 8
  • 16
0

hello are you trying to check it on android emulator? if yes than please use google-api emulator which will have support library in it. try to check in real android device and if its still giving you same error than add google play services in your project also.

Aiyaz Parmar
  • 562
  • 6
  • 17
  • YES m testing it on google API emuator and also have added google play services in my project but still having the problem – shifa fatima Oct 17 '14 at 09:35
  • if you have real android device than try to test on that. it will sure run on that. i too had same problem and when i run it on device than it gives me map. and when i tried to run in emulator than it gives me error in inflating class. – Aiyaz Parmar Oct 17 '14 at 11:22