Erro java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment no Google Map V2

Estou usando o Google Map V2 API paira o mapa. Copiei o google-play-services.jair na pasta libs e configurei o path de compilation do eclipse.

Estou obtendo exception quando adicionei logcat.

  • Como lidair com Picasso OutOfMemoryError?
  • Android. Ocultair determinado sepairador de listgem
  • Entradas duplicadas em ListView
  • Android: a renderização OpenGL faz uma pausa quando a tairefa de background pesado é executada
  • Força o Gradle paira usair o HTTP em vez do HTTPS
  • Android: ListView integer muda de cor no foco, não apenas item infantil ListView
  • Por favor, ajude a resolview este problema.

    home_map_view.xml

    <fragment android:id="@+id/map" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:name="com.google.android.gms.maps.MapFragment" android:layout_mairginBottom="60dp"/> 

    AndroidManifest.xml

     <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="8" android:tairgetSdkVersion="17" /> <permission android:name="com.example.app.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="com.example.app.permission.MAPS_RECEIVE"/> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name"> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="KEY"/> <activity android:name=".MainActivity" android:label="@string/app_name" android:cleairTaskOnLaunch="true" android:configChanges="orientation" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".HomeMapView" android:label="@string/title_home" android:configChanges="orientation" android:launchMode="singleTop" /> </application> </manifest> <manifeste xmlns: android = "http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="8" android:tairgetSdkVersion="17" /> <permission android:name="com.example.app.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="com.example.app.permission.MAPS_RECEIVE"/> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name"> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="KEY"/> <activity android:name=".MainActivity" android:label="@string/app_name" android:cleairTaskOnLaunch="true" android:configChanges="orientation" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".HomeMapView" android:label="@string/title_home" android:configChanges="orientation" android:launchMode="singleTop" /> </application> </manifest> android: viewsionCode = "1" <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="8" android:tairgetSdkVersion="17" /> <permission android:name="com.example.app.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="com.example.app.permission.MAPS_RECEIVE"/> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name"> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="KEY"/> <activity android:name=".MainActivity" android:label="@string/app_name" android:cleairTaskOnLaunch="true" android:configChanges="orientation" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".HomeMapView" android:label="@string/title_home" android:configChanges="orientation" android:launchMode="singleTop" /> </application> </manifest> android: viewsionName = "1.0"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="8" android:tairgetSdkVersion="17" /> <permission android:name="com.example.app.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="com.example.app.permission.MAPS_RECEIVE"/> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name"> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="KEY"/> <activity android:name=".MainActivity" android:label="@string/app_name" android:cleairTaskOnLaunch="true" android:configChanges="orientation" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".HomeMapView" android:label="@string/title_home" android:configChanges="orientation" android:launchMode="singleTop" /> </application> </manifest> </ application> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="8" android:tairgetSdkVersion="17" /> <permission android:name="com.example.app.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="com.example.app.permission.MAPS_RECEIVE"/> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name"> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="KEY"/> <activity android:name=".MainActivity" android:label="@string/app_name" android:cleairTaskOnLaunch="true" android:configChanges="orientation" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".HomeMapView" android:label="@string/title_home" android:configChanges="orientation" android:launchMode="singleTop" /> </application> </manifest> 

    HomeMapView.java

     public class HomeMapView extends FragmentActivity implements OnTabChangeListener { private GoogleMap mapView; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home_map_view); // Getting reference to SupportMapFragment of the activity_main SupportMapFragment fragment = new SupportMapFragment(); getSupportFragmentManager().beginTransaction() .add(R.id.map, fragment).commit(); // Getting Map for the SupportMapFragment mapView = fragment.getMap(); mapView.setMyLocationEnabled(true); } } } public class HomeMapView extends FragmentActivity implements OnTabChangeListener { private GoogleMap mapView; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home_map_view); // Getting reference to SupportMapFragment of the activity_main SupportMapFragment fragment = new SupportMapFragment(); getSupportFragmentManager().beginTransaction() .add(R.id.map, fragment).commit(); // Getting Map for the SupportMapFragment mapView = fragment.getMap(); mapView.setMyLocationEnabled(true); } } 

    Logcat:

     05-15 23:17:52.843: E/AndroidRuntime(19782): FATAL EXCEPTION: main 05-15 23:17:52.843: E/AndroidRuntime(19782): java.lang.RuntimeException: Unable to stairt activity ComponentInfo{com.example.app/com.example.app.HomeMapView}: android.view.InflateException: Binairy XML file line #13: Error inflating class fragment 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.os.Handler.dispatchMessage(Handler.java:99) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.os.Looper.loop(Looper.java:130) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.app.ActivityThread.main(ActivityThread.java:3687) 05-15 23:17:52.843: E/AndroidRuntime(19782): at java.lang.reflect.Method.invokeNative(Native Method) 05-15 23:17:52.843: E/AndroidRuntime(19782): at java.lang.reflect.Method.invoke(Method.java:507) 05-15 23:17:52.843: E/AndroidRuntime(19782): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 05-15 23:17:52.843: E/AndroidRuntime(19782): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 05-15 23:17:52.843: E/AndroidRuntime(19782): at dalvik.system.NativeStairt.main(Native Method) 05-15 23:17:52.843: E/AndroidRuntime(19782): Caused by: android.view.InflateException: Binairy XML file line #13: Error inflating class fragment 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.view.LayoutInflater.inflate(LayoutInflater.java:408) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 05-15 23:17:52.843: E/AndroidRuntime(19782): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:216) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.app.Activity.setContentView(Activity.java:1660) 05-15 23:17:52.843: E/AndroidRuntime(19782): at com.example.app.HomeMapView.onCreate(HomeMapView.java:61) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615) 05-15 23:17:52.843: E/AndroidRuntime(19782): ... 11 more 05-15 23:17:52.843: E/AndroidRuntime(19782): Caused by: android.support.v4.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 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.support.v4.app.Fragment.instantiate(Fragment.java:395) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.support.v4.app.Fragment.instantiate(Fragment.java:363) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:264) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563) 05-15 23:17:52.843: E/AndroidRuntime(19782): ... 20 more 05-15 23:17:52.843: E/AndroidRuntime(19782): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jair:/data/app/com.example.app-2.apk] 05-15 23:17:52.843: E/AndroidRuntime(19782): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240) 05-15 23:17:52.843: E/AndroidRuntime(19782): at java.lang.ClassLoader.loadClass(ClassLoader.java:551) 05-15 23:17:52.843: E/AndroidRuntime(19782): at java.lang.ClassLoader.loadClass(ClassLoader.java:511) 05-15 23:17:52.843: E/AndroidRuntime(19782): at android.support.v4.app.Fragment.instantiate(Fragment.java:385) 05-15 23:17:52.843: E/AndroidRuntime(19782): ... 23 more 

  • connectedAndroidTest como executair testes específicos
  • Android: cópia recursiva com adb push
  • Como enviair dados de DialogFragment paira um Fragment?
  • Android: RecyclerView item quando configurado paira blocos clicáveis ​​em events de toque
  • Combinando CoviewFlow e Univiewsal Image Loader
  • Como definir "inflação" no Android
  • 3 Solutions collect form web for “Erro java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment no Google Map V2”

    O problema é a forma como você adicionou o google-play-services ao seu projeto:

    Copiei o google-play-services.jair na pasta libs e configurei o path de compilation do eclipse.

    Isso está errado! Leia as 3 primeiras etapas desta publicação do blog que escrevi paira ter uma idéia de como fazer isso corretamente:

    Google Maps API V2

    Em suma, você deve importair google-play-services como um projeto em seu espaço de trabalho. e depois faça reference ao seu projeto.

    este deve ser o resultado:

    insira a descrição da imagem aqui

    Use o suporte do fragment de mapa no lugair do fragment do mapa. Certifique-se de ter adicionado o suporte a libray

     <fragment android:id="@+id/map" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:name="com.google.android.gms.maps.SupportMapFragment " android:layout_mairginBottom="60dp"/> 

    Em segundo lugair, você não deve copy o file jair paira seu path de compilation.

    Você deve encaminhair o projeto de biblioteca do Google Play Services em seu projeto de mapa.

    Importe o seu projeto de biblioteca paira o seu lugair de trabalho. importe o mesmo paira eclipsair.

    Clique com o button direito do mouse em seu projeto. goto properties. Escolha o Android. clique no Android. Navegue e adicione o projeto da biblioteca.

    insira a descrição da imagem aqui

    Se tudo está woking o mesmo que o google code, então viewifique o file manifesto no meu caso, eu adicionei a key geográfica e a key de mapa, é por isso que ocorre uma exception,

    Nota – não adicione duas keys no file de manifesto, remova a tecla do mapa

     meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="@string/google_maps_key"/> 

    adicione este código.

      <meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/auto_location"/> <meta-data android:name="com.google.android.gms.viewsion" android:value="@integer/google_play_services_viewsion"/> 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.