I have this in my class
import android.os.Bundle; import android.support.v4.app.FragmentActivity; import com.coffeeandcookies.ushuaiamovil.R; public class LayMapa2 extends FragmentActivity { @Override protected void onCreate(Bundle arg0) { setContentView(R.layout.lay_mapa2); super.onCreate(arg0); } }
This in my 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" />
This in my manifiest
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <permission android:name="com.coffeeandcookies.usuahiamovil.permission.MAPS_RECEIVE" android:protectionLevel="signature" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="com.coffeeandcookies.usuahiamovil.permission.MAPS_RECEIVE" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="saasadsad" />
And I have google-play-services_lib as library proyect in my workspace and the android-support-v4.jar
This is my logcat
07-17 11:46:10.945: E/AndroidRuntime(8241): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.coffeeandcookies.ushuaiamovil/com.coffeeandcookies.vistas.LayMapa2}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.app.ActivityThread.access$600(ActivityThread.java:140) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.os.Handler.dispatchMessage(Handler.java:99) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.os.Looper.loop(Looper.java:137) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.app.ActivityThread.main(ActivityThread.java:4895) 07-17 11:46:10.945: E/AndroidRuntime(8241): at java.lang.reflect.Method.invokeNative(Native Method) 07-17 11:46:10.945: E/AndroidRuntime(8241): at java.lang.reflect.Method.invoke(Method.java:511) 07-17 11:46:10.945: E/AndroidRuntime(8241): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994) 07-17 11:46:10.945: E/AndroidRuntime(8241): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761) 07-17 11:46:10.945: E/AndroidRuntime(8241): at dalvik.system.NativeStart.main(Native Method) 07-17 11:46:10.945: E/AndroidRuntime(8241): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.view.LayoutInflater.inflate(LayoutInflater.java:466) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 07-17 11:46:10.945: E/AndroidRuntime(8241): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:306) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.app.Activity.setContentView(Activity.java:1912) 07-17 11:46:10.945: E/AndroidRuntime(8241): at com.coffeeandcookies.vistas.LayMapa2.onCreate(LayMapa2.java:14) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.app.Activity.performCreate(Activity.java:5163) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061) 07-17 11:46:10.945: E/AndroidRuntime(8241): ... 11 more 07-17 11:46:10.945: E/AndroidRuntime(8241): Caused by: java.lang.ClassCastException: com.google.android.gms.maps.SupportMapFragment cannot be cast to android.app.Fragment 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.app.Fragment.instantiate(Fragment.java:577) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.app.Fragment.instantiate(Fragment.java:552) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.app.Activity.onCreateView(Activity.java:4806) 07-17 11:46:10.945: E/AndroidRuntime(8241): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680) 07-17 11:46:10.945: E/AndroidRuntime(8241): ... 20 more
Thanks!!!