i want to deploy google maps into my android application. i followed a step-by-step procedure which i found it here. But when i run the application. I got "Unfortunately your application has stopped error. I followed each step in that document. please let me know the error.
here is my logcat's output
04-18 12:15:30.416: I/Process(1423): Sending signal. PID: 1423 SIG: 9
04-18 12:15:31.676: W/dalvikvm(1443): VFY: unable to resolve static field 2529 (MapAttrs) in Lcom/google/android/gms/R$styleable;
04-18 12:15:31.676: D/dalvikvm(1443): VFY: replacing opcode 0x62 at 0x000e
04-18 12:15:31.686: D/AndroidRuntime(1443): Shutting down VM
04-18 12:15:31.686: W/dalvikvm(1443): threadid=1: thread exiting with uncaught exception (group=0xb1a6cba8)
04-18 12:15:31.726: E/AndroidRuntime(1443): FATAL EXCEPTION: main
04-18 12:15:31.726: E/AndroidRuntime(1443): Process: tarun.ksr.mymap, PID: 1443
04-18 12:15:31.726: E/AndroidRuntime(1443): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
04-18 12:15:31.726: E/AndroidRuntime(1443): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
04-18 12:15:31.726: E/AndroidRuntime(1443): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.app.Activity.onCreateView(Activity.java:4785)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
04-18 12:15:31.726: E/AndroidRuntime(1443): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.app.Activity.setContentView(Activity.java:1929)
04-18 12:15:31.726: E/AndroidRuntime(1443): at tarun.ksr.mymap.MainActivity.onCreate(MainActivity.java:20)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.app.Activity.performCreate(Activity.java:5231)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.app.ActivityThread.access$800(ActivityThread.java:135)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.os.Handler.dispatchMessage(Handler.java:102)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.os.Looper.loop(Looper.java:136)
04-18 12:15:31.726: E/AndroidRuntime(1443): at android.app.ActivityThread.main(ActivityThread.java:5017)
04-18 12:15:31.726: E/AndroidRuntime(1443): at java.lang.reflect.Method.invokeNative(Native Method)
04-18 12:15:31.726: E/AndroidRuntime(1443): at java.lang.reflect.Method.invoke(Method.java:515)
04-18 12:15:31.726: E/AndroidRuntime(1443): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
04-18 12:15:31.726: E/AndroidRuntime(1443): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
04-18 12:15:31.726: E/AndroidRuntime(1443): at dalvik.system.NativeStart.main(Native Method)
04-18 12:15:34.846: I/Process(1443): Sending signal. PID: 1443 SIG: 9
Here is my MainActivity.java
package tarun.ksr.mymap;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
public class MainActivity extends Activity {
private GoogleMap mMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
final LatLng CIU = new LatLng(35.21843892856462, 33.41662287712097);
Marker ciu = mMap.addMarker(new MarkerOptions().position(CIU).title("My Office"));
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
MANIFEST :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tarun.ksr.mymap"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<permission
android:name="com.example.androidmapsv2.permission.MAPS_RECEIVE"
android:protectionLevel="signature" >
</permission>
<uses-permission android:name="com.example.androidmapsv2.permission.MAPS_RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<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" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCfVTb5mW1c-q8RdBtX7NJJ0S1KXgkHUP0"/>
<activity
android:name="tarun.ksr.mymap.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>
</application>
Add this to the manifest-
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Also check whether the Google Play Services SDK is configured correctly.
https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2
Related
I am new in using google map api v2.
i do every thing base on this tutorial:
Android SDK: Working with Google Maps - Application Setup
but in 5 :
Add a Map to the App
when i add fragment to may layout, i got some rendering error in my preview and show me stack overflow error.
and when I Run my code this i see this errors:
02-20 21:36:37.601 11893-11893/com.example.gmt3 I/Process﹕ Sending signal. PID: 11893 SIG: 9
02-20 21:41:30.941 12732-12732/com.example.gmt3 D/dalvikvm﹕ Late-enabling CheckJNI
02-20 21:41:31.021 12732-12732/com.example.gmt3 W/ResourceType﹕ CREATING STRING CACHE OF 44 bytes
02-20 21:41:31.041 12732-12732/com.example.gmt3 D/AndroidRuntime﹕ Shutting down VM
02-20 21:41:31.041 12732-12732/com.example.gmt3 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41662d88)
02-20 21:41:31.051 12732-12732/com.example.gmt3 E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.gmt3, PID: 12732
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gmt3/com.example.gmt3.MyActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2237)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5137)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:297)
at android.app.Activity.setContentView(Activity.java:1929)
at com.example.gmt3.MyActivity.onCreate(MyActivity.java:14)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5137)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 5077000 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" />
at com.google.android.gms.common.GooglePlayServicesUtil.x(Unknown Source)
at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
at com.google.android.gms.maps.internal.u.F(Unknown Source)
at com.google.android.gms.maps.internal.u.E(Unknown Source)
at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
at com.google.android.gms.maps.MapFragment$b.ju(Unknown Source)
at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
at com.google.android.gms.dynamic.a.a(Unknown Source)
at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
at android.app.Activity.onCreateView(Activity.java:4785)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:297)
at android.app.Activity.setContentView(Activity.java:1929)
at com.example.gmt3.MyActivity.onCreate(MyActivity.java:14)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5137)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
at dalvik.system.NativeStart.main(Native Method)
02-20 21:42:01.901 13963-13963/com.example.gmt3 W/ResourceType﹕ CREATING STRING CACHE OF 44 bytes
02-20 21:42:01.921 13963-13963/com.example.gmt3 D/AndroidRuntime﹕ Shutting down VM
02-20 21:42:01.921 13963-13963/com.example.gmt3 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41662d88)
02-20 21:44:41.511 15098-15098/com.example.gmt3 D/dalvikvm﹕ Late-enabling CheckJNI
02-20 21:44:41.641 15098-15098/com.example.gmt3 W/ResourceType﹕ CREATING STRING CACHE OF 44 bytes
02-20 21:44:41.671 15098-15098/com.example.gmt3 I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: RGURRAM_AU_LINUX_ANDROID_LNX.LA.3.5.2.2_RB1.04.04.04.087.030+PATCH[ES]_msm8974_LNX.LA.3.5.2.2_RB1__release_ENGG ()
OpenGL ES Shader Compiler Version: E031.24.00.15
Build Date: 08/12/14 Tue
Local Branch:
Remote Branch: quic/LNX.LA.3.5.2.2_rb1
Local Patches: 8b00bd16f3c1d9d35a2fa902df5e679888d2b2e3 Fixes an llvm crash with mini dEQP apk
38bad22e162dead4e008444520a0144c78a347bd Fixes a potential dEQP crash.
ce345e1c45c2ae2d1fb2cb125c8d2574f1af5f95 Rev
02-20 21:44:41.701 15098-15098/com.example.gmt3 D/OpenGLRenderer﹕ Enabling debug mode 0
02-20 21:44:41.761 15098-15098/com.example.gmt3 I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy#42e245d8 time:70662662
02-20 21:51:39.711 15098-15098/com.example.gmt3 I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy#42e245d8 time:71080619
02-20 21:51:45.771 16948-16948/com.example.gmt3 W/ResourceType﹕ CREATING STRING CACHE OF 44 bytes
02-20 21:51:45.811 16948-16948/com.example.gmt3 I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: RGURRAM_AU_LINUX_ANDROID_LNX.LA.3.5.2.2_RB1.04.04.04.087.030+PATCH[ES]_msm8974_LNX.LA.3.5.2.2_RB1__release_ENGG ()
OpenGL ES Shader Compiler Version: E031.24.00.15
Build Date: 08/12/14 Tue
Local Branch:
Remote Branch: quic/LNX.LA.3.5.2.2_rb1
Local Patches: 8b00bd16f3c1d9d35a2fa902df5e679888d2b2e3 Fixes an llvm crash with mini dEQP apk
38bad22e162dead4e008444520a0144c78a347bd Fixes a potential dEQP crash.
ce345e1c45c2ae2d1fb2cb125c8d2574f1af5f95 Rev
02-20 21:51:45.851 16948-16948/com.example.gmt3 D/OpenGLRenderer﹕ Enabling debug mode 0
02-20 21:51:45.921 16948-16948/com.example.gmt3 I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy#428164f0 time:71086820
02-20 21:52:30.821 18305-18305/com.example.gmt3 D/dalvikvm﹕ Late-enabling CheckJNI
02-20 21:52:30.911 18305-18305/com.example.gmt3 W/ResourceType﹕ CREATING STRING CACHE OF 44 bytes
02-20 21:52:30.931 18305-18305/com.example.gmt3 D/AndroidRuntime﹕ Shutting down VM
02-20 21:52:30.931 18305-18305/com.example.gmt3 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41662d88)
02-20 21:52:30.941 18305-18305/com.example.gmt3 E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.gmt3, PID: 18305
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gmt3/com.example.gmt3.MyActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2237)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5137)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:297)
at android.app.Activity.setContentView(Activity.java:1929)
at com.example.gmt3.MyActivity.onCreate(MyActivity.java:14)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5137)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 5077000 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" />
at com.google.android.gms.common.GooglePlayServicesUtil.x(Unknown Source)
at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
at com.google.android.gms.maps.internal.u.F(Unknown Source)
at com.google.android.gms.maps.internal.u.E(Unknown Source)
at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
at com.google.android.gms.maps.MapFragment$b.ju(Unknown Source)
at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
at com.google.android.gms.dynamic.a.a(Unknown Source)
at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
at android.app.Activity.onCreateView(Activity.java:4785)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:297)
at android.app.Activity.setContentView(Activity.java:1929)
at com.example.gmt3.MyActivity.onCreate(MyActivity.java:14)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5137)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
at dalvik.system.NativeStart.main(Native Method)
can some one guide me about this?
pn: sorry for such a silly q.
Edit:
my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gmt3"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="17"/>
<permission android:name="com.example.gmt3.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.example.gmt3.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<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.ACCESS_NETWORK_STATE" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<application android:label="#string/app_name" android:icon="#drawable/ic_launcher">
<activity android:name="MyActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDg3mKRpkNhYeyxdrv2xjnkoS8mDt3qsmo" />
</application>
</manifest>
The answer is in the error log
The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 5077000 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" />
Maybe you have only forgotten to add this refference to your manifest
This question already has answers here:
After Google Play Service update to version 13 I got an error
(8 answers)
GoogleAPI key V2 RuntimeException [closed]
(1 answer)
Closed 8 years ago.
Im Creating an app step by step using this tutorial : google map api v2
But I'm getting Error ! I already tried and read many answer to resolve the error! But I can't resolve it
Logcat :
12-10 10:30:02.975: E/AndroidRuntime(2249): FATAL EXCEPTION: main
12-10 10:30:02.975: E/AndroidRuntime(2249): Process: com.example.finalymapapi, PID: 2249
12-10 10:30:02.975: E/AndroidRuntime(2249): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.finalymapapi/com.example.finalymapapi.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.app.ActivityThread.access$800(ActivityThread.java:135)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.os.Handler.dispatchMessage(Handler.java:102)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.os.Looper.loop(Looper.java:136)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.app.ActivityThread.main(ActivityThread.java:5017)
12-10 10:30:02.975: E/AndroidRuntime(2249): at java.lang.reflect.Method.invokeNative(Native Method)
12-10 10:30:02.975: E/AndroidRuntime(2249): at java.lang.reflect.Method.invoke(Method.java:515)
12-10 10:30:02.975: E/AndroidRuntime(2249): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
12-10 10:30:02.975: E/AndroidRuntime(2249): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
12-10 10:30:02.975: E/AndroidRuntime(2249): at dalvik.system.NativeStart.main(Native Method)
12-10 10:30:02.975: E/AndroidRuntime(2249): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
12-10 10:30:02.975: E/AndroidRuntime(2249): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.app.Activity.setContentView(Activity.java:1929)
12-10 10:30:02.975: E/AndroidRuntime(2249): at com.example.finalymapapi.MainActivity.onCreate(MainActivity.java:14)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.app.Activity.performCreate(Activity.java:5231)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
12-10 10:30:02.975: E/AndroidRuntime(2249): ... 11 more
12-10 10:30:02.975: E/AndroidRuntime(2249): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4452000 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" />
12-10 10:30:02.975: E/AndroidRuntime(2249): at com.google.android.gms.common.GooglePlayServicesUtil.t(Unknown Source)
12-10 10:30:02.975: E/AndroidRuntime(2249): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
12-10 10:30:02.975: E/AndroidRuntime(2249): at com.google.android.gms.maps.internal.u.B(Unknown Source)
12-10 10:30:02.975: E/AndroidRuntime(2249): at com.google.android.gms.maps.internal.u.A(Unknown Source)
12-10 10:30:02.975: E/AndroidRuntime(2249): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
12-10 10:30:02.975: E/AndroidRuntime(2249): at com.google.android.gms.maps.SupportMapFragment$b.ip(Unknown Source)
12-10 10:30:02.975: E/AndroidRuntime(2249): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
12-10 10:30:02.975: E/AndroidRuntime(2249): at com.google.android.gms.dynamic.a.a(Unknown Source)
12-10 10:30:02.975: E/AndroidRuntime(2249): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
12-10 10:30:02.975: E/AndroidRuntime(2249): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:290)
12-10 10:30:02.975: E/AndroidRuntime(2249): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
12-10 10:30:02.975: E/AndroidRuntime(2249): ... 20 more
Im get SHA1 from eclipse->Window->Preferences->android->Build
and my Manifist file :
<permission
android:name="your_package_name.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="your_package_name.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<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"/>
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.finalymapapi.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyAHkTtRSWMcC-mUz9jH9CBlrxoeV2Qon7c"/>
</application>
</manifest>
and my activity file :
My javafile :
add <meta-data> tag in <application> tag in your manifest.xml
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
if still crashes then check:
Use the mapFragment element as below in the xml
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_below="#+id/lineartab" />
You need to check the project properties:
Does Google API's selected?
Google play service lib project added?
Hope this helps.
As mentioned in the exception add the following line to <application> in you AndroidManifest.xml
<meta-data android:name="com.google.android.gms.version"android:value="#integer/google_play_services_version" />
I am trying to run Google maps API v2 on emulator. It says "unfortunately app has stoped" Here is my manifest.xml code. There is a huge number of errors. In the first line it gives error to define android.allowBackup which I have done on application tag.Please help me solve them.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<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="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permissionandroid:name="com.myapp.providers.gsf.permission.
READ_GSERVICES"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data android:name="com.google.android.gms.version" android:value="4030500" />
<!-- <meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" /> -->
<activity
android:name="com.myapp.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="My key"/>
</application>
</manifest>
----------------------------------------------------------------------------------------------
MainActivity.java
package myapp;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
public class MainActivity extends FragmentActivity {
private GoogleMap map;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SupportMapFragment mapFrag = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
map = mapFrag.getMap();
map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
}
}
------------------------------------------------------------------------------------
activity_main.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"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
-----------------------------------------------------------------
Logcat
E/Trace(690): error opening trace file: No such file or directory (2)
E/AndroidRuntime(690): FATAL EXCEPTION: main
E/AndroidRuntime(690): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{myapp/myapp.MainActivity}:android.view.InflateException: Binary XML file line #2:
Error inflating class fragment
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
android.app.ActivityThread.access$600(ActivityThread.java:130)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:4745)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
dalvik.system.NativeStart.main(Native Method)
09-01 15:06:56.709: E/AndroidRuntime(690): Caused by: android.view.InflateException: Binary XML
file line #2: Error inflating class fragment
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
android.view.LayoutInflater.inflate(LayoutInflater.java:466)
android.view.LayoutInflater.inflate(LayoutInflater.java:396)
android.view.LayoutInflater.inflate(LayoutInflater.java:352)
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
android.app.Activity.setContentView(Activity.java:1867)
android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.
java:110)
android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
myapp.MainActivity.onCreate(MainActivity.java:14)
android.app.Activity.performCreate(Activity.java:5008)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
AndroidRuntime(690): ... 11 more
AndroidRuntime(690): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's
AndroidManifest.xml does not have the right value. Expected 5089000 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" />
com.google.android.gms.common.GooglePlayServicesUtil.A(Unknown Source)
com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable
(Unknown Source)
com.google.android.gms.maps.internal.u.I(Unknown Source)
com.google.android.gms.maps.internal.u.H(Unknown Source)
com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
com.google.android.gms.maps.MapFragment$b.jz(Unknown Source)
com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
com.google.android.gms.dynamic.a.a(Unknown Source)
com.google.android.gms.dynamic.a.onInflate(Unknown Source)
com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
android.app.Activity.onCreateView(Activity.java:4663)
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
09-01 15:06:56.709: E/AndroidRuntime(690): ... 23 more
09-01 15:07:53.868: E/Trace(734): error opening trace file: No such file or directory (2)
09-01 15:07:54.479: E/AndroidRuntime(734): FATAL EXCEPTION: main
09-01 15:07:54.479: E/AndroidRuntime(734): java.lang.RuntimeException:
Unable to start activity ComponentInfo{myapp/myapp.MainActivity}
android.view.InflateException: Binary XML file line #2: Error inflating class fragment
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
android.app.ActivityThread.access$600(ActivityThread.java:130)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:4745)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
dalvik.system.NativeStart.main(Native Method)
09-01 15:07:54.479: E/AndroidRuntime(734): Caused by:
android.view.InflateException: Binary XML file line #2: Error inflating class fragment
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
android.view.LayoutInflater.inflate(LayoutInflater.java:466)
android.view.LayoutInflater.inflate(LayoutInflater.java:396)
android.view.LayoutInflater.inflate(LayoutInflater.java:352)
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
android.app.Activity.setContentView(Activity.java:1867)
android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
android.support.v7.app.ActionBarActivityDelegateICS.
setContentView(ActionBarActivityDelegateICS.java:110)
android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
myapp.MainActivity.onCreate(MainActivity.java:14)
android.app.Activity.performCreate(Activity.java:5008)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
E/AndroidRuntime(734): ... 11 more
E/AndroidRuntime(734): Caused by: java.lang.IllegalStateException: The meta-data tag in your
app's AndroidManifest.xml does not have the right value. Expected 5089000 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" />
com.google.android.gms.common.GooglePlayServicesUtil.A(Unknown Source)
com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable
(Unknown Source)
com.google.android.gms.maps.internal.u.I(Unknown Source)
com.google.android.gms.maps.internal.u.H(Unknown Source)
com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
com.google.android.gms.maps.MapFragment$b.jz(Unknown Source)
com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
com.google.android.gms.dynamic.a.a(Unknown Source)
com.google.android.gms.dynamic.a.onInflate(Unknown Source)
com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
android.app.Activity.onCreateView(Activity.java:4663)
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
09-01 15:07:54.479: E/AndroidRuntime(734): ... 23 more
error opening trace file: No such file or directory (2)
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{myapp/myapp.MainActivity}:
android.view.InflateException: Binary XML file line #2: Error inflating class fragment
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
android.app.ActivityThread.access$600(ActivityThread.java:130)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:4745)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
dalvik.system.NativeStart.main(Native Method)
09-01 15:12:22.938: E/AndroidRuntime(811): Caused by: android.view.InflateException: Binary XML
file line #2: Error inflating class fragment
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
android.view.LayoutInflater.inflate(LayoutInflater.java:466)
android.view.LayoutInflater.inflate(LayoutInflater.java:396)
android.view.LayoutInflater.inflate(LayoutInflater.java:352)
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
android.app.Activity.setContentView(Activity.java:1867)
android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
android.support.v7.app.ActionBarActivityDelegateICS.setContentView
(ActionBarActivityDelegateICS.java:110)
android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
myapp.MainActivity.onCreate(MainActivity.java:14)
android.app.Activity.performCreate(Activity.java:5008)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
09-01 15:12:22.938: E/AndroidRuntime(811): ... 11 more
09-01 15:12:22.938: E/AndroidRuntime(811): Caused by: java.lang.IllegalStateException: The meta-
data tag in your app's AndroidManifest.xml does not have the right value. Expected 5089000
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" />
com.google.android.gms.common.GooglePlayServicesUtil.A(Unknown Source)
com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable
(Unknown Source)
com.google.android.gms.maps.internal.u.I(Unknown Source)
com.google.android.gms.maps.internal.u.H(Unknown Source)
com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
com.google.android.gms.maps.MapFragment$b.jz(Unknown Source)
com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
com.google.android.gms.dynamic.a.a(Unknown Source)
com.google.android.gms.dynamic.a.onInflate(Unknown Source)
com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
android.app.Activity.onCreateView(Activity.java:4663)
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
09-01 15:19:34.508: E/Trace(826): error opening trace file: No such file or directory (2)
09-01 15:19:35.118: E/AndroidRuntime(826): FATAL EXCEPTION: main
09-01 15:19:35.118: E/AndroidRuntime(826): java.lang.RuntimeException:
Unable to start activity ComponentInfo{myapp/myapp.MainActivity}: android.view.InflateException:
Binary XML file line #2: Error inflating class fragment
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
android.app.ActivityThread.access$600(ActivityThread.java:130)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:4745)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
dalvik.system.NativeStart.main(Native Method)
09-01 15:19:35.118: E/AndroidRuntime(826): Caused by: android.view.InflateException: Binary XML
file line #2: Error inflating class fragment
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
android.view.LayoutInflater.inflate(LayoutInflater.java:466)
android.view.LayoutInflater.inflate(LayoutInflater.java:396)
android.view.LayoutInflater.inflate(LayoutInflater.java:352)
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
android.app.Activity.setContentView(Activity.java:1867)
android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
android.support.v7.app.ActionBarActivityDelegateICS.setContentView
(ActionBarActivityDelegateICS.java:110)
android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
myapp.MainActivity.onCreate(MainActivity.java:14)
android.app.Activity.performCreate(Activity.java:5008)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
09-01 15:19:35.118: E/AndroidRuntime(826): ... 11 more
09-01 15:19:35.118: E/AndroidRuntime(826): Caused by: java.lang.IllegalStateException:
The meta- data tag in your app's AndroidManifest.xml does not
have the right value. Expected 5089000 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" />
com.google.android.gms.common.GooglePlayServicesUtil.A(Unknown Source)
com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailabl
(Unknown Source)
com.google.android.gms.maps.internal.u.I(Unknown Source)
com.google.android.gms.maps.internal.u.H(Unknown Source)
com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
com.google.android.gms.maps.MapFragment$b.jz(Unknown Source)
com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
com.google.android.gms.dynamic.a.a(Unknown Source)
com.google.android.gms.dynamic.a.onInflate(Unknown Source)
com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
android.app.Activity.onCreateView(Activity.java:4663)
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
09-01 15:27:57.068: E/Trace(865): error opening trace file: No such file or directory (2)
09-01 15:27:57.748: E/AndroidRuntime(865): FATAL EXCEPTION: main
09-01 15:27:57.748: E/AndroidRuntime(865): java.lang.RuntimeException:
Unable to start activity ComponentInfo{myapp/myapp.MainActivity}:
android.view.InflateException: Binary XML file line #2: Error inflating class fragment
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
android.app.ActivityThread.access$600(ActivityThread.java:130)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:4745)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
dalvik.system.NativeStart.main(Native Method)
09-01 15:27:57.748: E/AndroidRuntime(865): Caused by: android.view.InflateException: Binary XML
file line #2: Error inflating class fragment
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
android.view.LayoutInflater.inflate(LayoutInflater.java:466)
android.view.LayoutInflater.inflate(LayoutInflater.java:396)
android.view.LayoutInflater.inflate(LayoutInflater.java:352)
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
android.app.Activity.setContentView(Activity.java:1867)
android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:217)
android.support.v7.app.ActionBarActivityDelegateICS.setContentView
(ActionBarActivityDelegateICS.java:110)
android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
myapp.MainActivity.onCreate(MainActivity.java:14)
android.app.Activity.performCreate(Activity.java:5008)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
09-01 15:27:57.748: E/AndroidRuntime(865): ... 11 more
09-01 15:27:57.748: E/AndroidRuntime(865): Caused by: java.lang.IllegalStateException:
The meta- data tag in your app's AndroidManifest.xml does not have the right value.
Expected 5089000 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" />
com.google.android.gms.common.GooglePlayServicesUtil.A(Unknown Source)
com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable
(Unknown Source)
com.google.android.gms.maps.internal.u.I(Unknown Source)
com.google.android.gms.maps.internal.u.H(Unknown Source)
com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
com.google.android.gms.maps.MapFragment$b.jz(Unknown Source)
com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
com.google.android.gms.dynamic.a.a(Unknown Source)
com.google.android.gms.dynamic.a.onInflate(Unknown Source)
com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
android.app.Activity.onCreateView(Activity.java:4663)
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
09-01 15:27:57.748: E/AndroidRuntime(865): ... 23 more
mmmh... Change
<meta-data android:name="com.google.android.gms.version" android:value="4030500" />
to
<meta-data android:name="com.google.android.gms.version" android:value="5089000" />
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<permission
android:name="com.myapp.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.myapp.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<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" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.myapp."Your activity name""
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="Your map key" />
</application>
</manifest>
Add the below permission to your Manifest.xml
<permission android:name="com.myapp.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
and replaca the below line:
<uses-permissionandroid:name="com.myapp.providers.gsf.permission.
READ_GSERVICES"/>
via
<uses-permission android:name="com.myapp.providers.gsf.permission.
READ_GSERVICES"/>
I know how to launch a new activity within my application, i.e. like continuing to a new screen. In my app when I continue to next screen I would like to display google maps. I can display google maps fine on a one screen application. I'm not sure how to go about this, any help would be greatly appreciated, a the moment it crashes when I try to launch the new activity.
MainActivity class->
package com.example.drivetext;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button b = (Button) findViewById(R.id.btnClick);
b.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// here i call new screen;
Intent i = new Intent(MainActivity.this, setdestination.class);
startActivity(i);
}
});
}
}
setdestination class->
package com.example.drivetext;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import android.os.Bundle;
import android.app.Activity;
public class setdestination extends Activity {
static final LatLng TutorialsPoint = new LatLng(21 , 57);
private GoogleMap googleMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.setdestination);
try {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().
findFragmentById(R.id.map)).getMap();
}
googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
Marker TP = googleMap.addMarker(new MarkerOptions().
position(TutorialsPoint).title("TutorialsPoint"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
Android Manifest->
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.drivetext"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="com.example.drivetext.permission.MAPS_RECEIVE" />
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="19" />
<permission
android:name="com.example.drivetext.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<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="com.example.drivetext.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=".setdestination" android:label="SetDestination"> </activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyC4VQ7nzxjPSjfObnnKqZxMZUOHACNNmP0" />
</application>
</manifest>
setdestination.xml->
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
Logcat output->
05-02 19:30:37.274: D/gralloc_goldfish(1443): Emulator without GPU emulation detected.
05-02 19:30:40.134: I/Choreographer(1443): Skipped 51 frames! The application may be doing too much work on its main thread.
05-02 19:30:40.894: W/GooglePlayServicesUtil(1443): Google Play services is missing.
05-02 19:30:40.904: W/GooglePlayServicesUtil(1443): Google Play services is missing.
05-02 19:30:40.904: W/GooglePlayServicesUtil(1443): Google Play services is missing.
05-02 19:30:40.974: W/GooglePlayServicesUtil(1443): Google Play services is missing.
05-02 19:30:40.984: W/GooglePlayServicesUtil(1443): Google Play services is missing.
05-02 19:30:41.044: W/GooglePlayServicesUtil(1443): Google Play services is missing.
05-02 19:30:41.084: W/GooglePlayServicesUtil(1443): Google Play services is missing.
05-02 19:30:41.094: W/GooglePlayServicesUtil(1443): Google Play services is missing.
05-02 19:30:41.104: W/GooglePlayServicesUtil(1443): Google Play services is missing.
05-02 19:30:41.194: W/GooglePlayServicesUtil(1443): Google Play services is missing.
05-02 19:30:41.234: W/GooglePlayServicesUtil(1443): Google Play services is missing.
05-02 19:30:41.234: D/AndroidRuntime(1443): Shutting down VM
05-02 19:30:41.234: W/dalvikvm(1443): threadid=1: thread exiting with uncaught exception (group=0xb4ac5ba8)
05-02 19:30:41.304: E/AndroidRuntime(1443): FATAL EXCEPTION: main
05-02 19:30:41.304: E/AndroidRuntime(1443): Process: com.example.drivetext, PID: 1443
05-02 19:30:41.304: E/AndroidRuntime(1443): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.drivetext/com.example.drivetext.setdestination}: java.lang.NullPointerException
05-02 19:30:41.304: E/AndroidRuntime(1443): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
05-02 19:30:41.304: E/AndroidRuntime(1443): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
05-02 19:30:41.304: E/AndroidRuntime(1443): at android.app.ActivityThread.access$800(ActivityThread.java:135)
05-02 19:30:41.304: E/AndroidRuntime(1443): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
05-02 19:30:41.304: E/AndroidRuntime(1443): at android.os.Handler.dispatchMessage(Handler.java:102)
05-02 19:30:41.304: E/AndroidRuntime(1443): at android.os.Looper.loop(Looper.java:136)
05-02 19:30:41.304: E/AndroidRuntime(1443): at android.app.ActivityThread.main(ActivityThread.java:5017)
05-02 19:30:41.304: E/AndroidRuntime(1443): at java.lang.reflect.Method.invokeNative(Native Method)
05-02 19:30:41.304: E/AndroidRuntime(1443): at java.lang.reflect.Method.invoke(Method.java:515)
05-02 19:30:41.304: E/AndroidRuntime(1443): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
05-02 19:30:41.304: E/AndroidRuntime(1443): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
05-02 19:30:41.304: E/AndroidRuntime(1443): at dalvik.system.NativeStart.main(Native Method)
05-02 19:30:41.304: E/AndroidRuntime(1443): Caused by: java.lang.NullPointerException
05-02 19:30:41.304: E/AndroidRuntime(1443): at com.example.drivetext.setdestination.onCreate(setdestination.java:20)
05-02 19:30:41.304: E/AndroidRuntime(1443): at android.app.Activity.performCreate(Activity.java:5231)
05-02 19:30:41.304: E/AndroidRuntime(1443): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
05-02 19:30:41.304: E/AndroidRuntime(1443): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
05-02 19:30:41.304: E/AndroidRuntime(1443): ... 11 more
05-02 19:30:44.104: I/Process(1443): Sending signal. PID: 1443 SIG: 9
05-02 19:49:25.004: D/gralloc_goldfish(1497): Emulator without GPU emulation detected.
05-02 19:49:27.224: I/Choreographer(1497): Skipped 34 frames! The application may be doing too much work on its main thread.
05-02 19:49:27.904: W/System.err(1497): java.lang.NullPointerException
05-02 19:49:27.904: W/System.err(1497): at com.example.drivetext.setdestination.onCreate(setdestination.java:22)
05-02 19:49:27.914: W/System.err(1497): at android.app.Activity.performCreate(Activity.java:5231)
05-02 19:49:27.914: W/System.err(1497): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
05-02 19:49:27.914: W/System.err(1497): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
05-02 19:49:27.914: W/System.err(1497): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
05-02 19:49:27.914: W/System.err(1497): at android.app.ActivityThread.access$800(ActivityThread.java:135)
05-02 19:49:27.914: W/System.err(1497): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
05-02 19:49:27.914: W/System.err(1497): at android.os.Handler.dispatchMessage(Handler.java:102)
05-02 19:49:27.914: W/System.err(1497): at android.os.Looper.loop(Looper.java:136)
05-02 19:49:27.914: W/System.err(1497): at android.app.ActivityThread.main(ActivityThread.java:5017)
05-02 19:49:27.944: W/System.err(1497): at java.lang.reflect.Method.invokeNative(Native Method)
05-02 19:49:27.944: W/System.err(1497): at java.lang.reflect.Method.invoke(Method.java:515)
05-02 19:49:27.944: W/System.err(1497): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
05-02 19:49:27.964: W/System.err(1497): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
05-02 19:49:27.964: W/System.err(1497): at dalvik.system.NativeStart.main(Native Method)
05-02 19:49:28.594: I/Choreographer(1497): Skipped 40 frames! The application may be doing too much work on its main thread.
05-02 19:50:41.204: I/Choreographer(1497): Skipped 280 frames! The application may be doing too much work on its main thread.
05-02 19:50:42.324: I/Choreographer(1497): Skipped 40 frames! The application may be doing too much work on its main thread.
05-02 19:50:46.424: I/Choreographer(1497): Skipped 71 frames! The application may be doing too much work on its main thread.
05-02 19:51:25.034: D/gralloc_goldfish(1554): Emulator without GPU emulation detected.
05-02 19:51:27.894: D/AndroidRuntime(1554): Shutting down VM
05-02 19:51:27.904: W/dalvikvm(1554): threadid=1: thread exiting with uncaught exception (group=0xb4ac5ba8)
05-02 19:51:28.034: E/AndroidRuntime(1554): FATAL EXCEPTION: main
05-02 19:51:28.034: E/AndroidRuntime(1554): Process: com.example.drivetext, PID: 1554
05-02 19:51:28.034: E/AndroidRuntime(1554): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.drivetext/com.example.drivetext.setdestination}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.app.ActivityThread.access$800(ActivityThread.java:135)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.os.Handler.dispatchMessage(Handler.java:102)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.os.Looper.loop(Looper.java:136)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.app.ActivityThread.main(ActivityThread.java:5017)
05-02 19:51:28.034: E/AndroidRuntime(1554): at java.lang.reflect.Method.invokeNative(Native Method)
05-02 19:51:28.034: E/AndroidRuntime(1554): at java.lang.reflect.Method.invoke(Method.java:515)
05-02 19:51:28.034: E/AndroidRuntime(1554): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
05-02 19:51:28.034: E/AndroidRuntime(1554): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
05-02 19:51:28.034: E/AndroidRuntime(1554): at dalvik.system.NativeStart.main(Native Method)
05-02 19:51:28.034: E/AndroidRuntime(1554): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
05-02 19:51:28.034: E/AndroidRuntime(1554): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.app.Activity.setContentView(Activity.java:1929)
05-02 19:51:28.034: E/AndroidRuntime(1554): at com.example.drivetext.setdestination.onCreate(setdestination.java:18)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.app.Activity.performCreate(Activity.java:5231)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
05-02 19:51:28.034: E/AndroidRuntime(1554): ... 11 more
05-02 19:51:28.034: E/AndroidRuntime(1554): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4323000 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" />
05-02 19:51:28.034: E/AndroidRuntime(1554): at com.google.android.gms.common.GooglePlayServicesUtil.t(Unknown Source)
05-02 19:51:28.034: E/AndroidRuntime(1554): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
05-02 19:51:28.034: E/AndroidRuntime(1554): at com.google.android.gms.maps.internal.q.B(Unknown Source)
05-02 19:51:28.034: E/AndroidRuntime(1554): at com.google.android.gms.maps.internal.q.A(Unknown Source)
05-02 19:51:28.034: E/AndroidRuntime(1554): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
05-02 19:51:28.034: E/AndroidRuntime(1554): at com.google.android.gms.maps.MapFragment$b.gW(Unknown Source)
05-02 19:51:28.034: E/AndroidRuntime(1554): at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
05-02 19:51:28.034: E/AndroidRuntime(1554): at com.google.android.gms.dynamic.a.a(Unknown Source)
05-02 19:51:28.034: E/AndroidRuntime(1554): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
05-02 19:51:28.034: E/AndroidRuntime(1554): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.app.Activity.onCreateView(Activity.java:4785)
05-02 19:51:28.034: E/AndroidRuntime(1554): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
05-02 19:51:28.034: E/AndroidRuntime(1554): ... 21 more
05-02 19:51:32.334: I/Process(1554): Sending signal. PID: 1554 SIG: 9
05-02 19:54:42.454: D/gralloc_goldfish(1606): Emulator without GPU emulation detected.
05-02 19:54:51.254: I/Choreographer(1606): Skipped 36 frames! The application may be doing too much work on its main thread.
05-02 19:54:51.924: D/AndroidRuntime(1606): Shutting down VM
05-02 19:54:51.924: W/dalvikvm(1606): threadid=1: thread exiting with uncaught exception (group=0xb4ac5ba8)
05-02 19:54:52.064: E/AndroidRuntime(1606): FATAL EXCEPTION: main
05-02 19:54:52.064: E/AndroidRuntime(1606): Process: com.example.drivetext, PID: 1606
05-02 19:54:52.064: E/AndroidRuntime(1606): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.drivetext/com.example.drivetext.setdestination}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.app.ActivityThread.access$800(ActivityThread.java:135)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.os.Handler.dispatchMessage(Handler.java:102)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.os.Looper.loop(Looper.java:136)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.app.ActivityThread.main(ActivityThread.java:5017)
05-02 19:54:52.064: E/AndroidRuntime(1606): at java.lang.reflect.Method.invokeNative(Native Method)
05-02 19:54:52.064: E/AndroidRuntime(1606): at java.lang.reflect.Method.invoke(Method.java:515)
05-02 19:54:52.064: E/AndroidRuntime(1606): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
05-02 19:54:52.064: E/AndroidRuntime(1606): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
05-02 19:54:52.064: E/AndroidRuntime(1606): at dalvik.system.NativeStart.main(Native Method)
05-02 19:54:52.064: E/AndroidRuntime(1606): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
05-02 19:54:52.064: E/AndroidRuntime(1606): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.app.Activity.setContentView(Activity.java:1929)
05-02 19:54:52.064: E/AndroidRuntime(1606): at com.example.drivetext.setdestination.onCreate(setdestination.java:18)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.app.Activity.performCreate(Activity.java:5231)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
05-02 19:54:52.064: E/AndroidRuntime(1606): ... 11 more
05-02 19:54:52.064: E/AndroidRuntime(1606): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4323000 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" />
05-02 19:54:52.064: E/AndroidRuntime(1606): at com.google.android.gms.common.GooglePlayServicesUtil.t(Unknown Source)
05-02 19:54:52.064: E/AndroidRuntime(1606): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
05-02 19:54:52.064: E/AndroidRuntime(1606): at com.google.android.gms.maps.internal.q.B(Unknown Source)
05-02 19:54:52.064: E/AndroidRuntime(1606): at com.google.android.gms.maps.internal.q.A(Unknown Source)
05-02 19:54:52.064: E/AndroidRuntime(1606): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
05-02 19:54:52.064: E/AndroidRuntime(1606): at com.google.android.gms.maps.MapFragment$b.gW(Unknown Source)
05-02 19:54:52.064: E/AndroidRuntime(1606): at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
05-02 19:54:52.064: E/AndroidRuntime(1606): at com.google.android.gms.dynamic.a.a(Unknown Source)
05-02 19:54:52.064: E/AndroidRuntime(1606): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
05-02 19:54:52.064: E/AndroidRuntime(1606): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.app.Activity.onCreateView(Activity.java:4785)
05-02 19:54:52.064: E/AndroidRuntime(1606): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
05-02 19:54:52.064: E/AndroidRuntime(1606): ... 21 more
05-02 19:54:55.424: I/Process(1606): Sending signal. PID: 1606 SIG: 9
The Error means that your current emulator is does not support Goolgle Play Service
Click here for more info on how to update your emulator to support google service
You missed out <meta-data> in your Android Manifest
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Try adding this..
I have been having this issue for over a week now where any attempt to call the 'onCreateView' method of SupportMapFragment class causes a runtime error. I have extended the SupportMapFragment class for debugging reasons. The application will compile and run, but when told to display a Google map fragment, immediately crashes with the familiar "unable to inflate map fragment" error.
Notes:
I use SupportMapFragment with FragmentActivity
Google API Level 10 is the Target
The 'return' statement under the SupportMapFragment class code (below) is where the issue occurs (known because of 5th LogCat output)
The Manifest file contains the meta data element for the Google Play Services Version
The Manifest file contains the meta data element for the Google Maps V2 API Key
The Manifest file contains the meta data element for GLES Version 2.0
The Manifest file contains the permission com.google.android.providers.gfs.permission.READ_GSERVICES (despite what LogCat says)
I have downloaded the Google Play Services from the SDK Manager
Android Private Libraries, Google APIs [Android2.2.3], and Android Dependencies are part of the project Java Build Path and are checked
The google-play-services_lib is a library in Properties -> Android
Run (and crashed) on AVD using Google API Level 4.2.2
Run (and crashed) on physical device using Google API Level 4.2.2
Manifest
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.softcrypt"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="10"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.google.android.providers.gfs.permission.READ_GSERVICES"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<!-- Libraries -->
<uses-library
android:name="com.google.android.maps"
android:required="true"/>
<!-- Activities -->
<activity
android:label="#string/app_name"
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".SoftCryptMapActivity"
android:label="Map"
android:enabled="true">
<intent-filter>
<action android:name="com.softcrypt.SoftCryptMapActivity"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<!-- Meta Data -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/apiKey" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"/>
</application>
LogCat
04-30 18:08:30.367: D/SoftCrypt(1555): SoftCryptMapActivity Started
04-30 18:08:30.787: D/dalvikvm(1555): GC_FOR_ALLOC freed 207K, 9% free 3178K/3456K, paused 40ms, total 42ms
04-30 18:08:30.857: I/Google Maps Android API(1555): Google Play services client version: 4323000
04-30 18:08:30.887: I/Google Maps Android API(1555): Google Play services package version: 4323030
04-30 18:08:30.927: D/SoftCrypt(1555): Creating MapFragment...
04-30 18:08:30.967: D/AndroidRuntime(1555): Shutting down VM
04-30 18:08:30.967: W/dalvikvm(1555): threadid=1: thread exiting with uncaught exception (group=0xb3b0dba8)
04-30 18:08:30.987: E/AndroidRuntime(1555): FATAL EXCEPTION: main
04-30 18:08:30.987: E/AndroidRuntime(1555): Process: com.softcrypt, PID: 1555
04-30 18:08:30.987: E/AndroidRuntime(1555): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.softcrypt/com.softcrypt.SoftCryptMapActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.app.ActivityThread.access$800(ActivityThread.java:135)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.os.Handler.dispatchMessage(Handler.java:102)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.os.Looper.loop(Looper.java:136)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.app.ActivityThread.main(ActivityThread.java:5017)
04-30 18:08:30.987: E/AndroidRuntime(1555): at java.lang.reflect.Method.invokeNative(Native Method)
04-30 18:08:30.987: E/AndroidRuntime(1555): at java.lang.reflect.Method.invoke(Method.java:515)
04-30 18:08:30.987: E/AndroidRuntime(1555): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
04-30 18:08:30.987: E/AndroidRuntime(1555): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
04-30 18:08:30.987: E/AndroidRuntime(1555): at dalvik.system.NativeStart.main(Native Method)
04-30 18:08:30.987: E/AndroidRuntime(1555): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
04-30 18:08:30.987: E/AndroidRuntime(1555): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.app.Activity.setContentView(Activity.java:1929)
04-30 18:08:30.987: E/AndroidRuntime(1555): at com.softcrypt.SoftCryptMapActivity.onCreate(SoftCryptMapActivity.java:33)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.app.Activity.performCreate(Activity.java:5231)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
04-30 18:08:30.987: E/AndroidRuntime(1555): ... 11 more
04-30 18:08:30.987: E/AndroidRuntime(1555): Caused by: java.lang.SecurityException: The Maps API requires the additional following permissions to be set in the AndroidManifest.xml to ensure a correct behavior:
04-30 18:08:30.987: E/AndroidRuntime(1555): <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
04-30 18:08:30.987: E/AndroidRuntime(1555): at maps.e.ci.a(Unknown Source)
04-30 18:08:30.987: E/AndroidRuntime(1555): at maps.e.ay.a(Unknown Source)
04-30 18:08:30.987: E/AndroidRuntime(1555): at maps.e.ay.a(Unknown Source)
04-30 18:08:30.987: E/AndroidRuntime(1555): at maps.e.al.a(Unknown Source)
04-30 18:08:30.987: E/AndroidRuntime(1555): at maps.e.bh.a(Unknown Source)
04-30 18:08:30.987: E/AndroidRuntime(1555): at maps.e.bg.a(Unknown Source)
04-30 18:08:30.987: E/AndroidRuntime(1555): at etu.onTransact(SourceFile:107)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.os.Binder.transact(Binder.java:361)
04-30 18:08:30.987: E/AndroidRuntime(1555): at com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown Source)
04-30 18:08:30.987: E/AndroidRuntime(1555): at com.google.android.gms.maps.SupportMapFragment$a.onCreateView(Unknown Source)
04-30 18:08:30.987: E/AndroidRuntime(1555): at com.google.android.gms.dynamic.a$4.b(Unknown Source)
04-30 18:08:30.987: E/AndroidRuntime(1555): at com.google.android.gms.dynamic.a.a(Unknown Source)
04-30 18:08:30.987: E/AndroidRuntime(1555): at com.google.android.gms.dynamic.a.onCreateView(Unknown Source)
04-30 18:08:30.987: E/AndroidRuntime(1555): at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
04-30 18:08:30.987: E/AndroidRuntime(1555): at com.softcrypt.SoftCryptMapFragment.onCreateView(SoftCryptMapFragment.java:24)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1093)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1195)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291)
04-30 18:08:30.987: E/AndroidRuntime(1555): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
04-30 18:08:30.987: E/AndroidRuntime(1555): ... 21 more
map_activity.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:baselineAligned="false"
android:orientation="vertical">
<fragment
android:id="#+id/mapFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:name="com.softcrypt.SoftCryptMapFragment"/>
FragmentActivity Subclass
public class SoftCryptMapActivity extends FragmentActivity
{
private GoogleMap map;
public void onCreate(Bundle savedInstanceState)
{
Log.d(super.getString(R.string.app_name), "SoftCryptMapActivity Started");
super.onCreate(savedInstanceState);
// Check for Service Availability
if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext()) != ConnectionResult.SUCCESS)
{
Toast.makeText(getBaseContext(), "No Service", Toast.LENGTH_LONG).show();
finish();
}
super.setContentView(R.layout.map_activity);
Log.d(super.getString(R.string.app_name), "Content View Set");
map = ((SupportMapFragment)super.getSupportFragmentManager().findFragmentById(R.id.mapFragment)).getMap();
// Check for Service Availability
if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext()) != ConnectionResult.SUCCESS)
{
Toast.makeText(getBaseContext(), "No Service", Toast.LENGTH_LONG).show();
finish();
}
}
}
SupportMapFragment Subclass
public class SoftCryptMapFragment extends SupportMapFragment
{
GoogleMap map;
FragmentManager fm;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
Log.d(super.getString(R.string.app_name), "Creating MapFragment...");
return super.onCreateView(inflater, container, savedInstanceState);
}
}
You need to add user permission com.google.android.providers.gsf.permission.READ_GSERVICES in you Manifest to use the MAP API
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
Your crash log , clearly shows that.
Caused by: java.lang.SecurityException: The Maps API requires the additional following permissions to be set in the AndroidManifest.xml to ensure a correct behavior: