0

I'm trying to implement Google's new api v2 on Android 2.3.3 with the debug.keystore

What ever i do i get a blank map..

Code:

public class MainFragment extends FragmentActivity{

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

activity_map.xml:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <fragment
        android:name="com.WhosAround.MainFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment"/>

</FrameLayout>

Manifest.xml:

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

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

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

    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="com.WhosAround.permission.MAPS_RECEIVE" />

    <permission
        android:name="com.WhosAround.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
    <permission
        android:name="com.WhosAround.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.example.permission.MAPS_RECEIVE" />
    <uses-permission android:name="com.WhosAround.permission.C2D_MESSAGE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

    <application
        android:name="com.WhosAround.AppVariables"
        android:allowBackup="true"
        android:icon="@drawable/questionmark"
        android:label="Who&apos;s Around?"
        android:theme="@android:style/Theme.NoTitleBar"
        android:windowSoftInputMode="stateHidden" >
        <uses-library android:name="com.google.android.maps" />
        <!-- android:name="com.WhosAround.Activities.PreLoader" -->
        <activity
            android:name=".MainFragment"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

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

</manifest>

any ideas ?

4

2 回答 2

1

由于某种原因,它突然起作用了......也许谷歌控制台服务器需要时间来更新......

于 2013-03-07T18:55:44.860 回答
0

我发现如果您更换计算机,您的调试 api 密钥就会失效。我必须为我的笔记本电脑和家里的电脑生成一个,然后在两者之间切换。这是因为它使用 pc mac 地址来验证代码。如果你没有改变电脑,你可以看看这个问题。

于 2013-03-07T18:36:38.760 回答