2016-07-30 8 views
0

AndroidスタジオプロジェクトでGoogleマップを設定しようとしましたが、異なるオプションを適用しても互換性のないタイプのエラーが発生した場合は、取り除くことができませんでした。エラーのあなたの時間と指導してくれてありがとうAndroidスタジオGoogleマップ互換性のないタイプのエラー

スクリーンショット

enter image description here

Logcateレポート

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" /> 

アクティビティコード

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); 

を変更するには

関連する問題