java - Android google maps v2 crashing on startup -
in android app supporting 2.2 , higher, trying use google maps api v2.
i have far:
does know issue is?
thanks.
xml
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" 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" tools:context=".activity_map" > <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.supportmapfragment"/> </relativelayout>
java
import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.supportmapfragment; import android.location.geocoder; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.view.menu; public class activity_map extends fragmentactivity { googlemap map = null; geocoder coder; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_map); map = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map)).getmap(); coder = new geocoder(this); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.activity_map, menu); return true; } }
manifest
<permission android:name="sord.common.permission.maps_receive" android:protectionlevel="signature" /> <uses-permission android:name="sord.common.permission.maps_receive" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.call_phone" /> <uses-permission android:name="android.permission.access_coarse_location" /> <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-feature android:glesversion="0x00020000" android:required="true" /> <uses-sdk android:minsdkversion="8" android:targetsdkversion="19" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="sord.ids_connect.activity_login" android:label="@string/app_name" android:screenorientation="portrait" android:windowsoftinputmode="adjustresize|statehidden" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="sord.ids_connect.activity_menu" android:label="@string/title_activity_menu" android:screenorientation="portrait" android:theme="@style/theme.appcompat.light.darkactionbar" > </activity> <activity android:name="sord.ids_connect.activity_profile" android:label="@string/title_activity_profile" android:screenorientation="portrait" android:theme="@style/theme.appcompat.light.darkactionbar" > </activity> <activity android:name="sord.ids_connect.activity_map" android:screenorientation="portrait" android:label="@string/title_activity_map" android:theme="@android:style/theme.notitlebar" > </activity> <meta-data android:name="com.google.android.maps.v2.api_key" android:value="my-key" /> </application>
crash log
12-29 22:44:58.103: e/androidruntime(7331): fatal exception: main 12-29 22:44:58.103: e/androidruntime(7331): java.lang.runtimeexception: unable start activity componentinfo{sord.ids_connect/sord.ids_connect.activity_map}: android.view.inflateexception: binary xml file line #11: error inflating class fragment 12-29 22:44:58.103: e/androidruntime(7331): @ android.app.activitythread.performlaunchactivity(activitythread.java:2110) 12-29 22:44:58.103: e/androidruntime(7331): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2135) 12-29 22:44:58.103: e/androidruntime(7331): @ android.app.activitythread.access$700(activitythread.java:143) 12-29 22:44:58.103: e/androidruntime(7331): @ android.app.activitythread$h.handlemessage(activitythread.java:1241) 12-29 22:44:58.103: e/androidruntime(7331): @ android.os.handler.dispatchmessage(handler.java:99) 12-29 22:44:58.103: e/androidruntime(7331): @ android.os.looper.loop(looper.java:137) 12-29 22:44:58.103: e/androidruntime(7331): @ android.app.activitythread.main(activitythread.java:4950) 12-29 22:44:58.103: e/androidruntime(7331): @ java.lang.reflect.method.invokenative(native method) 12-29 22:44:58.103: e/androidruntime(7331): @ java.lang.reflect.method.invoke(method.java:511) 12-29 22:44:58.103: e/androidruntime(7331): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1004) 12-29 22:44:58.103: e/androidruntime(7331): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:771) 12-29 22:44:58.103: e/androidruntime(7331): @ dalvik.system.nativestart.main(native method) 12-29 22:44:58.103: e/androidruntime(7331): caused by: android.view.inflateexception: binary xml file line #11: error inflating class fragment 12-29 22:44:58.103: e/androidruntime(7331): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:704) 12-29 22:44:58.103: e/androidruntime(7331): @ android.view.layoutinflater.rinflate(layoutinflater.java:746) 12-29 22:44:58.103: e/androidruntime(7331): @ android.view.layoutinflater.inflate(layoutinflater.java:489) 12-29 22:44:58.103: e/androidruntime(7331): @ android.view.layoutinflater.inflate(layoutinflater.java:396) 12-29 22:44:58.103: e/androidruntime(7331): @ android.view.layoutinflater.inflate(layoutinflater.java:352) 12-29 22:44:58.103: e/androidruntime(7331): @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:316) 12-29 22:44:58.103: e/androidruntime(7331): @ android.app.activity.setcontentview(activity.java:1915) 12-29 22:44:58.103: e/androidruntime(7331): @ sord.ids_connect.activity_map.oncreate(activity_map.java:18) 12-29 22:44:58.103: e/androidruntime(7331): @ android.app.activity.performcreate(activity.java:5177) 12-29 22:44:58.103: e/androidruntime(7331): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1094) 12-29 22:44:58.103: e/androidruntime(7331): @ android.app.activitythread.performlaunchactivity(activitythread.java:2074) 12-29 22:44:58.103: e/androidruntime(7331): ... 11 more 12-29 22:44:58.103: e/androidruntime(7331): caused by: java.lang.illegalstateexception: meta-data tag in app's androidmanifest.xml not have right value. expected 4030500 found 0. must have following declaration within <application> element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> 12-29 22:44:58.103: e/androidruntime(7331): @ com.google.android.gms.common.googleplayservicesutil.n(unknown source) 12-29 22:44:58.103: e/androidruntime(7331): @ com.google.android.gms.common.googleplayservicesutil.isgoogleplayservicesavailable(unknown source) 12-29 22:44:58.103: e/androidruntime(7331): @ com.google.android.gms.maps.internal.q.v(unknown source) 12-29 22:44:58.103: e/androidruntime(7331): @ com.google.android.gms.maps.internal.q.u(unknown source) 12-29 22:44:58.103: e/androidruntime(7331): @ com.google.android.gms.maps.mapsinitializer.initialize(unknown source) 12-29 22:44:58.103: e/androidruntime(7331): @ com.google.android.gms.maps.supportmapfragment$b.ce(unknown source) 12-29 22:44:58.103: e/androidruntime(7331): @ com.google.android.gms.maps.supportmapfragment$b.a(unknown source) 12-29 22:44:58.103: e/androidruntime(7331): @ com.google.android.gms.dynamic.a.a(unknown source) 12-29 22:44:58.103: e/androidruntime(7331): @ com.google.android.gms.dynamic.a.oninflate(unknown source) 12-29 22:44:58.103: e/androidruntime(7331): @ com.google.android.gms.maps.supportmapfragment.oninflate(unknown source) 12-29 22:44:58.103: e/androidruntime(7331): @ android.support.v4.app.fragmentactivity.oncreateview(fragmentactivity.java:290) 12-29 22:44:58.103: e/androidruntime(7331): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:676) 12-29 22:44:58.103: e/androidruntime(7331): ... 21 more
add manifest under <mata-data />
, above </application>
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
the log-cat clear you, identified problem as:
java.lang.illegalstateexception: meta-data tag in app's androidmanifest.xml not have right value. expected 4030500 found 0. must have following declaration within <application> element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
inform me if worked, happy programming
Comments
Post a Comment