0

I have issues trying to implement Google Maps to my app, please see details below, help would be appreciated.

Activity.xml (activity_locate_store):

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/map"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:name="com.google.android.gms.maps.SupportMapFragment"/>

Activity.java (LocateStore):

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class LocateStore extends FragmentActivity  {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_locate_store);
}

Mainfest.xml

    <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/MyTheme" >

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

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

Android Value from Google Lib (Google Play Services - res/value):

<resources>
<integer name="google_play_services_version">4242000</integer>

Logcat:

Caused by: android.view.InflateException: Binary XML file line #2: Error inflating    class fragment 04-10 17:23:41.787: E/AndroidRuntime(794): 

 Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public

Logcat Update:

04-10 17:41:47.130: E/ActivityThread(625): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d16440 that was originally bound here
04-10 17:41:47.130: E/ActivityThread(625): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d16440 that was originally bound here
04-10 17:41:47.130: E/ActivityThread(625):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
04-10 17:41:47.130: E/ActivityThread(625):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
04-10 17:41:47.130: E/ActivityThread(625):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
04-10 17:41:47.130: E/ActivityThread(625):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
04-10 17:41:47.130: E/ActivityThread(625):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
04-10 17:41:47.130: E/ActivityThread(625):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
04-10 17:41:47.130: E/ActivityThread(625):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
04-10 17:41:47.130: E/ActivityThread(625):  at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
04-10 17:41:47.130: E/ActivityThread(625):  at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
04-10 17:41:47.130: E/ActivityThread(625):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
04-10 17:41:47.130: E/ActivityThread(625):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
04-10 17:41:47.130: E/ActivityThread(625):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
04-10 17:41:47.130: E/ActivityThread(625):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
04-10 17:41:47.130: E/ActivityThread(625):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
04-10 17:41:47.130: E/ActivityThread(625):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
04-10 17:41:47.130: E/ActivityThread(625):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
04-10 17:41:47.130: E/ActivityThread(625):  at java.lang.Thread.run(Thread.java:856)
04-10 17:41:47.160: E/StrictMode(625): null
04-10 17:41:47.160: E/StrictMode(625): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d16440 that was originally bound here
04-10 17:41:47.160: E/StrictMode(625):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
04-10 17:41:47.160: E/StrictMode(625):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
04-10 17:41:47.160: E/StrictMode(625):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
04-10 17:41:47.160: E/StrictMode(625):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
04-10 17:41:47.160: E/StrictMode(625):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
04-10 17:41:47.160: E/StrictMode(625):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
04-10 17:41:47.160: E/StrictMode(625):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
04-10 17:41:47.160: E/StrictMode(625):  at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
04-10 17:41:47.160: E/StrictMode(625):  at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
04-10 17:41:47.160: E/StrictMode(625):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
04-10 17:41:47.160: E/StrictMode(625):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
04-10 17:41:47.160: E/StrictMode(625):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
04-10 17:41:47.160: E/StrictMode(625):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
04-10 17:41:47.160: E/StrictMode(625):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
04-10 17:41:47.160: E/StrictMode(625):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
04-10 17:41:47.160: E/StrictMode(625):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
04-10 17:41:47.160: E/StrictMode(625):  at java.lang.Thread.run(Thread.java:856)
04-10 17:41:47.160: W/ActivityManager(290): Unbind failed: could not find connection for android.os.BinderProxy@40ebb860
04-10 17:41:47.180: E/ActivityThread(625): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d16098 that was originally bound here
04-10 17:41:47.180: E/ActivityThread(625): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d16098 that was originally bound here
04-10 17:41:47.180: E/ActivityThread(625):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
04-10 17:41:47.180: E/ActivityThread(625):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
04-10 17:41:47.180: E/ActivityThread(625):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
04-10 17:41:47.180: E/ActivityThread(625):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
04-10 17:41:47.180: E/ActivityThread(625):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
04-10 17:41:47.180: E/ActivityThread(625):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
04-10 17:41:47.180: E/ActivityThread(625):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
04-10 17:41:47.180: E/ActivityThread(625):  at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
04-10 17:41:47.180: E/ActivityThread(625):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
04-10 17:41:47.180: E/ActivityThread(625):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
04-10 17:41:47.180: E/ActivityThread(625):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
04-10 17:41:47.180: E/ActivityThread(625):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
04-10 17:41:47.180: E/ActivityThread(625):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
04-10 17:41:47.180: E/ActivityThread(625):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
04-10 17:41:47.180: E/ActivityThread(625):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
04-10 17:41:47.180: E/ActivityThread(625):  at java.lang.Thread.run(Thread.java:856)
: E/(): Device disconnected

Logcat Update2:

04-10 18:10:30.357: E/AndroidRuntime(794): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment 04-10 18:10:30.357: E/AndroidRuntime(794): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4242000 but found 0. You must have the following declaration within the element:

TwoStarII
  • 351
  • 3
  • 17
  • can you post the full stacktrace and do check if you have referenced google play services properly – Raghunandan Apr 10 '14 at 17:38
  • no you din't you post the part that does no have the cause by part – Raghunandan Apr 10 '14 at 17:45
  • @Raghunandan - now im getting a different caused by error. the problem is all these updates that eclipse and google do!!!!!!!! – TwoStarII Apr 10 '14 at 18:12
  • did you add the jar to your app? – natez0r Apr 10 '14 at 18:14
  • @natez0r i've imported google-play-services_lib and linked the library as well if that's waht you mean – TwoStarII Apr 10 '14 at 18:15
  • Yeah, sorry. I forgot it was added as a library project. Google's docs may be out of date, but https://developers.google.com/maps/documentation/android/start#install_and_configure_the_google_play_services_sdk says that the name for the metadata item should be: "com.google.android.gms.version". Have you tried changing your meta-data name to that? – natez0r Apr 10 '14 at 18:21
  • @natez0r :) now we're getting somewhere - i'm now getting "Google Play services is not supported by your device..." I guess it now has to do with my emulator – TwoStarII Apr 10 '14 at 18:24
  • IIRC you need a physical device for it. – natez0r Apr 10 '14 at 18:26
  • @natez0r I've seen tutorials where they run Google Maps on an emulator, i would prefer in order to avoid downloading my app onto my device to test the whole time, i'm sure there's settings i have to include or setup on my virtual device wouldn't you agree? – TwoStarII Apr 10 '14 at 18:29
  • Are you using an emulator with the "Google APIs"? Check out the answer here: http://stackoverflow.com/a/14536645/395176 – natez0r Apr 10 '14 at 18:30
  • @natez0r Thank you, now I just need to update Google Play Services.. I'll do so and provide feedback (successful or failed) – TwoStarII Apr 10 '14 at 19:06
  • @natez0r - ok I'll leave this for another day, back to my original question, post your answer and I'll select and vote it up! – TwoStarII Apr 10 '14 at 19:22

1 Answers1

1

Google's docs may be out of date, but developers.google.com/maps/documentation/android/… says that the name for the metadata item should be: "com.google.android.gms.version". Have you tried changing your meta-data name to that?

natez0r
  • 1,064
  • 9
  • 14