3
  1. 私は2日間グーグルで検索しましたが、それでもこのメッセージが表示されます。nexus 7でデバッグキーを使用してデバッグします。
  2. どこが悪いのかわからない。私は正しいキーを持っています、正しいAPIアクセスを開きます
  3. しかし、タブレットの Google マップはまだ空白です。

マップフラグメント:

    public View onCreateView(LayoutInflater inflater, ViewGroup container,

Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.map_fragment,container, false); container.removeAllViews(); map = ((SupportMapFragment)getActivity() .getSupportFragmentManager() .findFragmentById(R.id.map)) .getMap(); map.setMyLocationEnabled(true); map.setMapType(GoogleMap.MAP_TYPE_NORMAL);

   mMapFragment = SupportMapFragment.newInstance();
   FragmentTransaction fragmentTransaction = 

getChildFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.map,mMapFragment);
fragmentTransaction.commit(); rootView を返します。}

マニフェスト:

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="16" />

<!-- Google Map -->   <permission
      android:name="com.jertt.xxx.permission.MAPS_RECEIVE"
      android:protectionLevel="signature"/>
<uses-permission android:name="com.jertt.yummymap.permission.MAPS_RECEIVE"/>

<!-- end -->

<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />

<!-- end -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.jertt.yummymap.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>

    <!-- Google Map API Key -->

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyB54eZnUp8Sw*****" />

    <!-- end -->
</application>

map_fragment.xml

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

4

3 に答える 3

1

これがあなたの問題かどうかはわかりませんが、私はこれを理解しようと多くの時間を費やしています. アクセス許可を確認し、API キーを再生成します。最後に、私のために働いた別の答えで小さなコメントを見ました。

debug.keystore ファイルの名前を変更し、クリーンアップしてからビルドします。これにより、新しい debug.keystore が生成されます。新しい SHA1 フィンガープリント。その新しいフィンガープリントを API コンソールに接続して、再試行してください。

他に確認できることは、API にアクセスしようとしているプロジェクトの API コンソールの「レポート」セクションを確認することです。プロジェクトを実行しようとして、その API のトラフィックがない場合は、SHA1 フィンガープリントまたは指定したパッケージ名が間違っている可能性があります。私の場合は指紋でした。

于 2013-08-01T03:08:13.280 に答える
0

最小 SDK は 14 です。使用する必要はありませんSupportMapFragment。を使用しMapFragmentます。

https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/MapFragment .

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

また

  GoogleMap  mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
                                .getMap();

権限もありません

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

すべての手順に従っていることを確認してください @

https://developers.google.com/maps/documentation/android/

編集:コメントから

ドキュメントからの引用

API 12 以降をターゲットMapFragmentにしている場合にのみ、classを使用してください。それ以外の場合は、SupportMapFragment を使用してください。

于 2013-07-25T05:04:15.137 に答える
0

これに変更する必要があります:

GoogleMap  mMap = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map))
                            .getMap();

また、ライブラリをマニフェスト ファイルに含めます。

<uses-library
        android:name="com.google.android.maps"
        android:required="true" />
于 2013-07-25T05:12:52.217 に答える