android,谷歌地图api v2错误

时间:2014-10-08 23:50:12

标签: android api google-maps

我正在尝试为Google地图v2开发一个应用。我遵循了所有的指示。我生成API_KEY并将其放入android清单文件中。 在“订购和导出”选项卡上,我在项目中选中了“Android私有库”。我也为它引用的库项目做了这个。 但是当我在模拟器中运行应用程序以及Android设备时,我得到错误。我的日志猫像

一样错误
10-09 03:02:37.905: E/PAUSE(2949): TIMERS!
10-09 03:02:37.921: W/dalvikvm(2949): VFY: unable to find class referenced in signature (Lcom/google/android/gms/maps/GoogleMap;)
10-09 03:02:37.921: I/dalvikvm(2949): Could not find method com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable, referenced from method com.zarrin.negar.LocationActivity.checkGooglePlayServicesForUpdate
10-09 03:02:37.921: W/dalvikvm(2949): VFY: unable to resolve static method 3699: Lcom/google/android/gms/common/GooglePlayServicesUtil;.isGooglePlayServicesAvailable (Landroid/content/Context;)I
10-09 03:02:37.925: D/dalvikvm(2949): VFY: replacing opcode 0x71 at 0x0005
10-09 03:02:37.925: E/dalvikvm(2949): Could not find class 'com.google.android.gms.maps.SupportMapFragment', referenced from method com.zarrin.negar.LocationActivity.initialization
10-09 03:02:37.925: W/dalvikvm(2949): VFY: unable to resolve check-cast 615 (Lcom/google/android/gms/maps/SupportMapFragment;) in Lcom/zarrin/negar/LocationActivity;
10-09 03:02:37.933: D/dalvikvm(2949): VFY: replacing opcode 0x1f at 0x0021
10-09 03:02:37.937: E/dalvikvm(2949): Could not find class 'com.google.android.gms.maps.model.LatLng', referenced from method com.zarrin.negar.LocationActivity.setGps
10-09 03:02:37.941: W/dalvikvm(2949): VFY: unable to resolve new-instance 618 (Lcom/google/android/gms/maps/model/LatLng;) in Lcom/zarrin/negar/LocationActivity;
10-09 03:02:37.941: D/dalvikvm(2949): VFY: replacing opcode 0x22 at 0x0021
10-09 03:02:37.941: E/dalvikvm(2949): Could not find class 'com.google.android.gms.maps.model.LatLng', referenced from method com.zarrin.negar.LocationActivity.setLocation
10-09 03:02:37.945: W/dalvikvm(2949): VFY: unable to resolve new-instance 618 (Lcom/google/android/gms/maps/model/LatLng;) in Lcom/zarrin/negar/LocationActivity;
10-09 03:02:37.945: D/dalvikvm(2949): VFY: replacing opcode 0x22 at 0x001e
10-09 03:02:37.949: D/dalvikvm(2949): DexOpt: unable to opt direct call 0x0f0e at 0x27 in Lcom/zarrin/negar/LocationActivity;.setGps
10-09 03:02:37.949: D/dalvikvm(2949): DexOpt: unable to opt direct call 0x0f10 at 0x37 in Lcom/zarrin/negar/LocationActivity;.setGps
10-09 03:02:37.949: D/dalvikvm(2949): DexOpt: unable to opt direct call 0x0f0e at 0x40 in Lcom/zarrin/negar/LocationActivity;.setGps
10-09 03:02:37.949: I/dalvikvm(2949): Failed resolving Lcom/zarrin/negar/LocationActivity$1; interface 612 'Lcom/google/android/gms/maps/GoogleMap$OnMapClickListener;'

清单:

<uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="18" />
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.CLEAR_CACHE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<permission
    android:name="com.zarrin.negar.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.zarrin.negar.permission.C2D_MESSAGE" />

<permission
    android:name="com.zarrin.negar.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.zarrin.negar.permission.MAPS_RECEIVE" />
<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

和我的活动:

<activity
        android:name="com.zarrin.negar.LocationActivity"
        android:screenOrientation="portrait" 
        android:launchMode="singleTop" >
    </activity>

元数据:

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

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

我项目属性的图片:

image 1

image 2

1 个答案:

答案 0 :(得分:0)

这可能是因为您的项目配置或您的模拟器配置。

项目

  • 您是否已从您的网站导入Google Play服务项目 SDK?

仿真器

  • 您的模拟器是否安装了Google Play服务?尝试运行 带SDK(Google API)的模拟器
好运好友!