well I try to make this sample at he developer page
https://developers.google.com/maps/documentation/android/start?hl=tr#obtain_a_google_maps_api_key
this is my java code:
package com.example.mapdemo;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
and xml code:
<?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.MapFragment"/>
but if I try to do this on REAL DEVICE, Log cat says:
02-13 17:28:59.327: W/dalvikvm(12793): threadid=1: thread exiting with uncaught exception (group=0x410c02a0)
02-13 17:28:59.327: E/AndroidRuntime(12793): FATAL EXCEPTION: main
02-13 17:28:59.327: E/AndroidRuntime(12793): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{com.restroomgames.urfarehberi/com.restroomgames.urfarehberi.MainActivity}:
android.view.InflateException: Binary XML file line #2: Error inflating class fragment
also:
02-13 17:28:59.327: E/AndroidRuntime(12793): Caused by:
android.app.Fragment$InstantiationException: Unable to instantiate fragment
com.google.android.gms.maps.MapFragment: make sure class name exists, is public, and has an
empty constructor that is public
also:
02-13 17:28:59.327: E/AndroidRuntime(12793): Caused by:
java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment
This video helped me: https://www.youtube.com/watch?v=fitjMdZ8jqM I think The problem is Debug.keystore or google play service because I changed them, the problem vanished.
Also I wrote the solution on my webpage:
It seems that your using a wrong pattern for inflating.
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.restroomgames.urfarehberi/com.restroomgames.urfarehberi.MainActivity}:
android.view.InflateException: Binary XML file line #2: Error inflating class fragmen
Look at this solution: https://stackoverflow.com/a/15137231/2523005