2016-07-30 2 views
0

Android Studio 프로젝트에서 Google지도를 설정하려고하지만 다른 옵션을 적용한 후에도 호환되지 않는 유형의 오류가 발생하면이를 제거 할 수 없습니다.Android Studio Google지도 호환되지 않는 유형 오류

enter image description here

Error:(454, 88) error: incompatible types: Fragment cannot be converted to SupportMapFragment 

XML 코드

<fragment 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/map2" 
      class="com.google.android.gms.maps.SupportMapFragment" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 

활동 코드

를보고 Logcate 시간과지도 오류의

스크린 샷을 주셔서 감사합니다

public class Search extends FragmentActivity implements OnMapReadyCallback 

private void initializeMap() 
{ 

    SupportMapFragment map = ((SupportMapFragment)  getFragmentManager().findFragmentById(R.id.map2)).getMapAsync(this); 
} 

@Override 
public void onMapReady(GoogleMap googleMap) { 

} 

답변

0

시도는이 SO question

을 확인, 자세한 내용은이 라인

SupportMapFragment map = ((SupportMapFragment)getFragmentManager().findFragmentById(R.id.map2)).getMapAsync(this); 

SupportMapFragment map = ((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map2)).getMapAsync(this); 

을 변경하려면

관련 문제