2013-05-25 1 views
1

문제가 "java.lang.ClassNotFoundExeption : com.google.android.gms.maps.MapFragment"내가 프로젝트 이클립스를 실행할 수 없습니다, ADT는, 구글 안드로이드지도 V2는

난이 비디오 http://www.youtube.com/watch?v=awX5T-EwLPc 내 일식을 따라 Java 개발자 용 Eclipse IDE, 버전 : Juno 서비스 릴리스 2 adt - ADT 22.0 Google Play 서비스 v5가 포함되어 있습니다 (v7이 내 에뮬레이터에서 Google Play 용 업데이트를 받으러 오면) 간단한 프로젝트이지만 그렇지 않습니다. 이보다 더 쉬운 일이 무엇인지 알아 나는이 지역에서 신선하고 일주일 내내이 문제를 해결하지 못했다.

AndroidManifest.xml 
<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.googlemapv2demo" 
    android:versionCode="1" 
    android:versionName="1.0" > 

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

    <permission  
     android:name="com.example.googlemapv2demo.permission.MAPS_RECEIVE" 
     android:protectionLevel="signature"/> 
    <uses-permission android:name="com.example.googlemapv2demo.permission.MAPS_RECEIVE"/>  

    <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="com.google.android.providers.gsf.permission.READ_GSERVICES"/> 
    <!-- The following two permissions are not required to use 
     Google Maps Android API v2, but are recommended. --> 
    <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="AIzaSyAoZvfHoOtBXenGq0OC2itsW4hFa5Tmjuw"/> 

     <activity 
      android:name="com.example.googlemapv2demo.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> 

</manifest> 

activite_main.xml 
<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context=".MainActivity" > 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/hello_world" /> 

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

</RelativeLayout> 


MainActivity.java 
package com.example.googlemapv2demo; 

import android.os.Bundle; 
import android.app.Activity; 
import android.view.Menu; 

public class MainActivity extends Activity { 

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

    @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; 
    } 

} 
+1

http://stackoverflow.com/questions/16636039/java-lang-classnotfoundexception-after-changing-nothing-in-the-project-but-upgra/16636127#16636127. adt를 22 번으로 업데이트 한 경우이 방법을 시도해보십시오. 또한 에뮬레이터가 아닌 기기에서 앱을 테스트해야합니다. 당신은 당신이 에뮬레이터에서 그것을 실행하고 싶다면 이것을 점검 할 수있다. 그러나 나는이 자신을 테스트하지 않았다 – Raghunandan

+0

http://blog-emildesign.rhcloud.com/?p=527 에뮬레이터에 runnign지도에 대해 – Raghunandan

+0

도움이되지 않았다 이 링크 나는 당신이 게시 한 것을 보았고, 도움을 받았다. 업데이 트 google 플레이 서비스와 함께 proble 해결하지만 현재 문제는 내 프로젝트가 –

답변

1

MapFragment는 API 레벨 12에서만 사용할 수 있으며 매니페스트에 따르면 오래된 버전도 지원합니다. 앱을 실행하려면 google이 출시 한 지원 라이브러리의 SupportMapFragment를 사용하십시오.

+0

도움이되지 않았습니다. 이 "public class MainActivity extends FragmentActivity"및 this android : name = "com.google.android.gms.maps .SupportMapFragment " 문제는 이제"java.lang.ClassNotFoundExeption : com.google.android.gms.maps.SupportMapFragment " –

+0

입니다. 포트 라이브러리가 libs 폴더에 있습니다. –

+0

여기에 안드로이드 개인 라이브러리> C : \ Users \ +++ \ workspace \ GoogleMapV2Demo \ libs \ android-support-v4.jar –

관련 문제