마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

Google Map V2 InflateException

0 추천

안녕하세요..

구글 맵 띄우고 있는데요.. 자꾸 같은 문제로 같은 에러가 나서 이렇게 글을 적게 되었습니다.

로그캣에 나오는 에러는 아래와 같구요.. (무슨파일인지 찾아보면 해당 액티비티 onCreate만 찾아가네요.)

Could not find class 'com.google.android.gms.maps.SupportMapFragment', referenced from method com.example.googlemapv2test.MainActivity.onCreate
 
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.googlemapv2test/com.example.googlemapv2test.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class fragment
 
Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class fragment
 
Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public
 
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.SupportMapFragment" on path: DexPathList[[zip file "/data/app/com.example.googlemapv2test-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.googlemapv2test-1, /vendor/lib, /system/lib]]
 
 
 
저기서 에러있다고 하는 xml파일의 13번째 줄은
 
        <fragment                                   <<이부분입니다.                                                                               
            android:id="@+id/map"
            android:name="com.google.android.gms.maps.SupportMapFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
 
xml파일은 별 다른 특이한 것도 없고
 
MainActivity도 FragmentActivity를 상속받고 있구요.
 
메니페스트 파일에서도 퍼미션, 메타데이터 2개(API키, 버전) 다 넣었구요..
 
 
1
 
google-play-services_lib 이거 프로젝트 라이브러리로 참고하고,
Java Build Path에서 Order and Export에 있는 거 체크 다 했고
Android Dependencies에 
google-play-services_lib.jar
android-support-v4.jar
google-play-services.jar 이렇게 들어있네요.
(스샷에 빌드 타겟이 두갠데 4.2로 해도 안되고 4.4.2로 해도 안됩니다. 원래는 4.2 하나만 있었을 때도 안됬구요.)
 
 
넣어주라는 건 다 넣어 준 것 같은데 자꾸 익셉션 나구요..
 
 
2
 
제가 SDK Manager에서 구글 플레이 서비스가 없어서 따로 다운받아서 import 시켜줬는데
그런 것 때문에 문제가 생긴다거나 하나요?
 
 
 
-_- 세시간동안 뭘 해도 같은 에러만 나오니 미칠 것 같네요.. 
relz (2,550 포인트) 님이 2014년 11월 13일 질문

1개의 답변

0 추천
 
채택된 답변

SupportMapFragment 을 MapFragment 로 바꿔보세요.

저는 Fragment 상속받은 클래스에서 SupportMapFragment를 넣으니까 저렇더라구요.

 

저는 http://susemi99.kr/2264 이런 방법으로 바꿔서 쓰고 있어요 

 

쎄미 (162,410 포인트) 님이 2014년 11월 14일 답변
relz님이 2014년 11월 21일 채택됨
답글 주셔서 감사합니다.. 링크 보고 했는데도 안되네요 ㅠㅠ
Could not find class 이런 메세지만 나오구요..
보니까 저거만 그러는 게 아니라 프로젝트 라이브러리 쓰는 것 마다 이러네요.. ㅠㅠ
와우!!!!!!!!!!!!!!!!!!!!!!!!!!!!!4시간 짜리를 한문장으로 끝내주시다니 ㅠㅠㅠ감사합니다ㅠ퓨ㅠㅠㅠㅠㅠ
...