Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/07/2014, 06:53
porygon_humano
 
Fecha de Ingreso: abril-2009
Ubicación: Bogota
Mensajes: 217
Antigüedad: 15 años, 8 meses
Puntos: 1
Error inflating class fragment con google map

hola a todos, estoy tratando de hacer una aplicación que me carga un mapa usando el GoogleMap (de un ejercicio planteado en un vídeo que me pasaron pero al tratarlo de hacer aunque lo hago idéntico, no me funciona a mi), pero se me presenta un error al tratar de ejecutarlo en el emulador de android y no se como solucionarlo, por favor ayudaaaa

este proyecto usa android 4.2.2

el error es
Cita:
07-23 12:20:15.920: E/AndroidRuntime(835): FATAL EXCEPTION: main
07-23 12:20:15.920: E/AndroidRuntime(835): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.googlemap/com.example.googlemap.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
07-23 12:20:15.920: E/AndroidRuntime(835): at android.app.ActivityThread.performLaunchActivity(A ctivityThread.java:2180)
07-23 12:20:15.920: E/AndroidRuntime(835): at android.app.ActivityThread.handleLaunchActivity(Ac tivityThread.java:2230)
07-23 12:20:15.920: E/AndroidRuntime(835): at android.app.ActivityThread.access$600(ActivityThre ad.java:141)
07-23 12:20:15.920: E/AndroidRuntime(835): at android.app.ActivityThread$H.handleMessage(Activit yThread.java:1234)
07-23 12:20:15.920: E/AndroidRuntime(835): at android.os.Handler.dispatchMessage(Handler.java:99 )
07-23 12:20:15.920: E/AndroidRuntime(835): at android.os.Looper.loop(Looper.java:137)
07-23 12:20:15.920: E/AndroidRuntime(835): at android.app.ActivityThread.main(ActivityThread.jav a:5041)
07-23 12:20:15.920: E/AndroidRuntime(835): at java.lang.reflect.Method.invokeNative(Native Method)
07-23 12:20:15.920: E/AndroidRuntime(835): at java.lang.reflect.Method.invoke(Method.java:511)
07-23 12:20:15.920: E/AndroidRuntime(835): at com.android.internal.os.ZygoteInit$MethodAndArgsCa ller.run(ZygoteInit.java:793)
07-23 12:20:15.920: E/AndroidRuntime(835): at com.android.internal.os.ZygoteInit.main(ZygoteInit .java:560)
07-23 12:20:15.920: E/AndroidRuntime(835): at dalvik.system.NativeStart.main(Native Method)
07-23 12:20:15.920: E/AndroidRuntime(835): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
07-23 12:20:15.920: E/AndroidRuntime(835): at android.view.LayoutInflater.createViewFromTag(Layo utInflater.java:704)
07-23 12:20:15.920: E/AndroidRuntime(835): at android.view.LayoutInflater.inflate(LayoutInflater .java:466)
07-23 12:20:15.920: E/AndroidRuntime(835): at android.view.LayoutInflater.inflate(LayoutInflater .java:396)
07-23 12:20:15.920: E/AndroidRuntime(835): at android.view.LayoutInflater.inflate(LayoutInflater .java:352)
07-23 12:20:15.920: E/AndroidRuntime(835): at com.android.internal.policy.impl.PhoneWindow.setCo ntentView(PhoneWindow.java:270)
07-23 12:20:15.920: E/AndroidRuntime(835): at android.app.Activity.setContentView(Activity.java: 1881)
07-23 12:20:15.920: E/AndroidRuntime(835): at com.example.googlemap.MainActivity.onCreate(MainAc tivity.java:41)
07-23 12:20:15.920: E/AndroidRuntime(835): at android.app.Activity.performCreate(Activity.java:5 104)
07-23 12:20:15.920: E/AndroidRuntime(835): at android.app.Instrumentation.callActivityOnCreate(I nstrumentation.java:1080)
07-23 12:20:15.920: E/AndroidRuntime(835): at android.app.ActivityThread.performLaunchActivity(A ctivityThread.java:2144)
07-23 12:20:15.920: E/AndroidRuntime(835): ... 11 more
07-23 12:20:15.920: E/AndroidRuntime(835): 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" />
07-23 12:20:15.920: E/AndroidRuntime(835): at com.google.android.gms.common.GooglePlayServicesUt il.x(Unknown Source)
07-23 12:20:15.920: E/AndroidRuntime(835): at com.google.android.gms.common.GooglePlayServicesUt il.isGooglePlayServicesAvailable(Unknown Source)
07-23 12:20:15.920: E/AndroidRuntime(835): at com.google.android.gms.maps.internal.u.F(Unknown Source)
07-23 12:20:15.920: E/AndroidRuntime(835): at com.google.android.gms.maps.internal.u.E(Unknown Source)
07-23 12:20:15.920: E/AndroidRuntime(835): at com.google.android.gms.maps.MapsInitializer.initia lize(Unknown Source)
07-23 12:20:15.920: E/AndroidRuntime(835): at com.google.android.gms.maps.SupportMapFragment$b.j u(Unknown Source)
07-23 12:20:15.920: E/AndroidRuntime(835): at com.google.android.gms.maps.SupportMapFragment$b.a (Unknown Source)
07-23 12:20:15.920: E/AndroidRuntime(835): at com.google.android.gms.dynamic.a.a(Unknown Source)
07-23 12:20:15.920: E/AndroidRuntime(835): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
07-23 12:20:15.920: E/AndroidRuntime(835): at com.google.android.gms.maps.SupportMapFragment.onI nflate(Unknown Source)
07-23 12:20:15.920: E/AndroidRuntime(835): at android.support.v4.app.FragmentActivity.onCreateVi ew(FragmentActivity.java:291)
07-23 12:20:15.920: E/AndroidRuntime(835): at android.view.LayoutInflater.createViewFromTag(Layo utInflater.java:676)
07-23 12:20:15.920: E/AndroidRuntime(835): ... 20 more
manifiest.xml
Cita:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googlemap"
android:versionCode="1"
android:versionName="1.0" >

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

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

<permission
android:name="com.example.googlemap"
android:protectionLevel="signature"></permission>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.per mission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_ST ATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_ST ORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOC ATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCAT ION"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_E XTRA_COMMANDS"/>
<uses-permission android:name="com.google.android.providers.gsf.per mission.READ_GSERVICES" />
<uses-permission android:name="com.example.permission.MAPS_RECEIVE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".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="AIzaSyBXpI7LGTCg4fIzuTWeJhfQDLL70_L dsFQ"></meta-data>
</application>

</manifest>
el activity_main.xml (en este e intentado tanto con el android:name="com.google.android.gms.maps.MapFragm ent" cambiandolo a android:name="com.google.android.gms.maps.SupportM apFragment" y tampoco a funcionado)
Cita:
<?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.MapFragm ent" />
el MainActivity.java
Cita:
package com.example.googlemap;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import twitter4j.QueryResult;
import twitter4j.Twitter;

import com.example.googlemap.datamodel.Tweet;
import com.example.googlemap.twitter.TwitterOperation;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnMarkerClic kListener;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptor ;
import com.google.android.gms.maps.model.BitmapDescriptor Factory;
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 com.google.android.gms.maps.model.Polyline;
import com.google.android.gms.maps.model.PolylineOptions;

import android.support.v7.app.ActionBarActivity;
//import android.app.Fragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.app.Activity;
import android.app.ProgressDialog;
import android.location.Address;
import android.location.Geocoder;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

//en el ejercicio donde lo vi lo plantean con Activity pero también intente con FragmentActivity y ActionBarActiviy y tampoco funcionaron
public class MainActivity extends Activity {
//public class MainActivity extends FragmentActivity {
//public class MainActivity extends ActionBarActivity {

private GoogleMap map = null;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

}

}
gracias por su atención y ojala me puedan ayudar
__________________
cuidensen y que arceus los acompanhe