NoSuchFieldError:在使用 MapFragment 和 Play Services 6.5 时没有类型的静

2023-02-01移动开发问题
3

本文介绍了NoSuchFieldError:在使用 MapFragment 和 Play Services 6.5 时没有类型的静态字段 MapAttrs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

也许我在这里遗漏了一些东西,但我无法在 Play Services 6.5 中使用新的 Maps only 依赖项

Maybe I am missing something here, but I am not able to use the new Maps only dependency in Play Services 6.5

我得到以下异常:

java.lang.NoSuchFieldError: No static field MapAttrs of type 
    [I in class Lcom/google/android/gms/R$styleable; or its superclasses 
    (declaration of 'com.google.android.gms.R$styleable' appears in 
    /data/app/com.kaching.merchant.dev1-1/base.apk)
        at com.google.android.gms.maps.GoogleMapOptions
            .createFromAttributes(Unknown Source)
        at com.google.android.gms.maps.SupportMapFragment
            .onInflate(Unknown Source)

清单:

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

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


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

Gradle 文件:

compile 'com.google.android.gms:play-services-maps:6.5.+'
compile 'com.android.support:support-v4:21.0.2'

布局:

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

这是坏了还是我做错了什么?

Is this broken or am I doing something wrong?

完整的捆绑包让我超过了 dex 限制,我不想使用 multidex

The full bundle pushes me over the dex limit and I would prefer not to use multidex

推荐答案

通过 SDK 管理器将您的 Google 存储库 更新到版本 15 应该可以解决问题并消除需求对于解决方法.需要清理项目.

Updating your Google Repository to version 15 via the SDK Manager should resolve the issues and eliminate the needs for the workarounds. A project clean is required.

issue 7432

This is also mentioned in issue 7432.

这篇关于NoSuchFieldError:在使用 MapFragment 和 Play Services 6.5 时没有类型的静态字段 MapAttrs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

硬件音量按钮更改应用程序音量
Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)...
2024-08-12 移动开发问题
10

恢复游戏 cocos2d
Resume game cocos2d(恢复游戏 cocos2d)...
2024-08-12 移动开发问题
6

突出显示朗读文本(在 iPhone 的故事书类型应用程序中)
Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))...
2024-08-12 移动开发问题
9

Cocos2D + 仅禁用 Retina iPad 图形
Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)...
2024-08-12 移动开发问题
10

如何将 32 位 PNG 转换为 RGB565?
How to convert 32 bit PNG to RGB565?(如何将 32 位 PNG 转换为 RGB565?)...
2024-08-12 移动开发问题
21

游戏中心 facebook 喜欢
Game center facebook like(游戏中心 facebook 喜欢)...
2024-08-12 移动开发问题
3