GoogleMap错误

时间:2014-06-26 16:31:38

标签: java android eclipse google-maps

我正在设计这个涉及使用Google地图的Android应用程序。我从Google获得了API_KEY并将其插入到我的清单文件中。但是当我运行应用程序时,我得到的只是一个错误。下面是我的清单文件以及LogCat错误:

的Manifest.xml

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

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

    <!-- Permissions -->
    <permission
        android:name="com.src.apps.myekoapp.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.src.apps.myekoapp.permission.MAPS_RECEIVE" />
    <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" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

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

    <uses-permission android:name="android.permission.CALL_PHONE" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.src.apps.myekoapp.SplashActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".MainActivity" />
        <activity android:name=".RSSList" />
        <activity android:name=".DetailsFragment" />
        <activity android:name=".EkoMap" />
        <activity android:name=".CallLASMA" />

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

</manifest>

LogCat错误:

06-26 16:14:16.570: E/AndroidRuntime(369): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4452000 but found 0.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

06-26 16:14:16.570: E/AndroidRuntime(369):  at com.google.android.gms.common.GooglePlayServicesUtil.t(Unknown Source)

06-26 16:14:16.570: E/AndroidRuntime(369):  at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)

06-26 16:14:16.570: E/AndroidRuntime(369):  at com.google.android.gms.maps.internal.u.B(Unknown Source)

06-26 16:14:16.570: E/AndroidRuntime(369):  at com.google.android.gms.maps.internal.u.A(Unknown Source)

06-26 16:14:16.570: E/AndroidRuntime(369):  at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)

06-26 16:14:16.570: E/AndroidRuntime(369):  at com.google.android.gms.maps.MapFragment$b.ip(Unknown Source)

06-26 16:14:16.570: E/AndroidRuntime(369):  at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)

06-26 16:14:16.570: E/AndroidRuntime(369):  at com.google.android.gms.dynamic.a.a(Unknown Source)

06-26 16:14:16.570: E/AndroidRuntime(369):  at com.google.android.gms.dynamic.a.onCreate(Unknown Source)

06-26 16:14:16.570: E/AndroidRuntime(369):  at com.google.android.gms.maps.MapFragment.onCreate(Unknown Source)

06-26 16:14:16.570: E/AndroidRuntime(369):  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:697)

06-26 16:14:16.570: E/AndroidRuntime(369):  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:900)

06-26 16:14:16.570: E/AndroidRuntime(369):  at android.app.FragmentManagerImpl.addFragment(FragmentManager.java:978)

06-26 16:14:16.570: E/AndroidRuntime(369):  at android.app.Activity.onCreateView(Activity.java:4090)

06-26 16:14:16.570: E/AndroidRuntime(369):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:664)

06-26 16:14:16.570: E/AndroidRuntime(369):  ... 19 more

06-26 16:14:53.350: I/Process(369): Sending signal. PID: 369 SIG: 9

请问哪里出错了?我已经看过很多这方面的教程,并且已经按照他们的步骤进行了操作,但是当他们的工作正常时我会收到这个错误。

2 个答案:

答案 0 :(得分:0)

您需要直接放置api密钥,而不是对values文件夹的引用。

答案 1 :(得分:0)

您必须在清单文件中添加:

<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />