1

I have an application that uses google maps. Previously, it was working fine, but last night I was updating some things in the sdk manager and doing so caused my map activity to crash my app. After multiple tries at fixing it, I updated to the newest version of eclipse, redownloaded the google play services, and generated a new API key. However, my app is still crashing when running it on my android device and I can't figure out why. Please please help. Below is my manifest file (which I updated with my new API key), along with the log that contains the errors. Any help at all would much appreciated. Thanks. Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.workoutprofile"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="5"
        android:targetSdkVersion="17" />

    <permission
        android:name="com.example.workoutprofile.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>
    <uses-permission android:name="com.example.workoutprofile.permission.MAPS_RECEIVE"/>

    <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-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

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

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

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

        <activity
            android:name="com.example.workoutprofile.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <activity android:name="Map"></activity>
        <activity android:name="Record"></activity>
        <activity android:name="Setup"></activity>
        <activity android:name="Bluetooth"></activity>
        <activity android:name="Chart"></activity>
        <activity android:name="History"></activity>
        <activity android:name="org.achartengine.GraphicalActivity"></activity>
        <activity android:name="Test"></activity>
        <activity android:name="MapTest"></activity>
    </application>


</manifest>

LogCat:

11-06 20:35:57.708: D/dalvikvm(12454): DexOpt: couldn't find field Landroid/content/res/Configuration;.smallestScreenWidthDp
11-06 20:35:57.708: W/dalvikvm(12454): VFY: unable to resolve instance field 32
11-06 20:35:57.708: D/dalvikvm(12454): VFY: replacing opcode 0x52 at 0x0012
11-06 20:35:57.708: D/dalvikvm(12454): VFY: dead code 0x0014-0018 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b (Landroid/content/res/Resources;)Z
11-06 20:35:57.715: D/AndroidRuntime(12454): Shutting down VM
11-06 20:35:57.715: W/dalvikvm(12454): threadid=1: thread exiting with uncaught exception (group=0x4001e560)
11-06 20:35:57.723: E/AndroidRuntime(12454): FATAL EXCEPTION: main
11-06 20:35:57.723: E/AndroidRuntime(12454): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.workoutprofile/com.example.workoutprofile.Map}: android.view.InflateException: Binary XML file line #19: Error inflating class fragment
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1702)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1722)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.app.ActivityThread.access$1500(ActivityThread.java:124)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:974)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.os.Looper.loop(Looper.java:130)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.app.ActivityThread.main(ActivityThread.java:3821)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at java.lang.reflect.Method.invokeNative(Native Method)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at java.lang.reflect.Method.invoke(Method.java:507)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at dalvik.system.NativeStart.main(Native Method)
11-06 20:35:57.723: E/AndroidRuntime(12454): Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class fragment
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:253)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.app.Activity.setContentView(Activity.java:1716)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at com.example.workoutprofile.Map.onCreate(Map.java:64)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1666)
11-06 20:35:57.723: E/AndroidRuntime(12454):    ... 11 more
11-06 20:35:57.723: E/AndroidRuntime(12454): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4030500 but found 0.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
11-06 20:35:57.723: E/AndroidRuntime(12454):    at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at com.google.android.gms.maps.internal.q.v(Unknown Source)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at com.google.android.gms.maps.internal.q.u(Unknown Source)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at com.google.android.gms.maps.SupportMapFragment$b.cE(Unknown Source)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at com.google.android.gms.dynamic.a.a(Unknown Source)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
11-06 20:35:57.723: E/AndroidRuntime(12454):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
11-06 20:35:57.723: E/AndroidRuntime(12454):    ... 20 more

Map Layout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin" >

    <TextView
        android:id="@+id/mapHeader"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:text="MAP"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="480dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true" />

    <Button
        android:id="@+id/buttonRouteStart"
        android:layout_width="125dp"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/buttonScreenshot"
        android:layout_alignBottom="@+id/buttonScreenshot"
        android:layout_alignRight="@+id/map"
        android:text="Route" />

    <Button
        android:id="@+id/buttonScreenshot"
        android:layout_width="125dp"
        android:layout_height="wrap_content"
        android:layout_below="@+id/mapHeader"
        android:layout_alignLeft="@+id/map"
        android:text="Save" />

</RelativeLayout>
Kara
  • 6,115
  • 16
  • 50
  • 57
user2822397
  • 21
  • 1
  • 4
  • Can you post your map layout here and in which android version you are running this app? – SHASHIDHAR MANCHUKONDA Nov 07 '13 at 02:50
  • Ok I added it to my original post. The android version on the device I am using is Android version 2.3.4 (API 10?), which previously had no trouble running it. – user2822397 Nov 07 '13 at 03:43
  • check whether google play services added to build path properly Go to Project|Properties Choose the Java Build Path section in "Order and Export" tab select googleplay service and clean your project – SHASHIDHAR MANCHUKONDA Nov 07 '13 at 03:57
  • Did that but still got the same error. Is there anything that could be told from that error? Like whether it is a problem with the API key or something? This stuff is pretty foreign to me for the most part...really bummed that it stopped working all of the sudden. – user2822397 Nov 07 '13 at 04:24

1 Answers1

3

The api key that you have provided is wrong. The key doesn't contain "-". Go to cloud console . Select android in Platform. Select Accessing "APIs directly from Android" provide package name and SHA1 fingerprint.Copy paste the generated API Key. Also make sure "Google Maps Android API v2" under API and auth is turned on.

Edit : Google have updated the library hence the problem. The solution to your problem can be found here

Community
  • 1
  • 1
Anirudha Agashe
  • 3,510
  • 2
  • 32
  • 47
  • Ok I checked that "Google Maps Android API v2" is turned on and generated a new android key. I am getting my SHA1 from Preferences>Android>Build in Eclipse. Using the "Key for Android apps (with certificates)" that I generated is still getting me the same error as above though – user2822397 Nov 07 '13 at 05:27
  • Am I using the wrong SHA1 fingerprint perhaps? As I said, I am getting it through Eclipse>Properties>Android>Build and am using SHA1 under "Default debug keystore". Do I need to be using a custom debug keystore? – user2822397 Nov 07 '13 at 05:29
  • no that keystore works fine for development purpose and yes it gives the proper sha1 fingerprint. Does your newly created key contains "-" as well ? I have created couple of keys for map i have never seen "-" in them. Did you update the package name ? – Anirudha Agashe Nov 07 '13 at 05:35
  • Check out the link i posted. You have to add another meta-data tag in the manifest. Sorry for troubling you to create another api key – Anirudha Agashe Nov 07 '13 at 05:40
  • No '-' in this new one, there is an '_' though. When you say update the package name, I'm assuming you mean when generating the code? As in SHA1;com.example.workoutprofile, in my case? – user2822397 Nov 07 '13 at 05:41
  • see the edited answer. go to link http://stackoverflow.com/questions/19724113/google-play-services-update – Anirudha Agashe Nov 07 '13 at 05:58
  • THAT WORKED!!! Wow you are a lifesaver, I'm not sure I would've ever found that. Thank you thank you thank you! – user2822397 Nov 07 '13 at 06:14