即时运行和谷歌地图的问题

Posted

技术标签:

【中文标题】即时运行和谷歌地图的问题【英文标题】:Issue with instant run and Google Maps 【发布时间】:2017-05-24 07:45:37 【问题描述】:

即时运行和 Google 地图似乎存在问题。重新运行应用程序以查看更改时,如果应用程序正在使用 Google 地图,则会发生崩溃。这是堆栈跟踪的一部分:

java.lang.RuntimeException: 
android.content.res.Resources$NotFoundException: File res/drawable/common_google_signin_btn_text_light_focused.xml from drawable resource ID 
           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
           ........
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/common_google_signin_btn_text_light_focused.xml from drawable resource ID 
          at android.content.res.Resources.loadDrawableForCookie(Resources.java:2640)
          .....
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-xxhdpi-v4/maps_btn_myl_pressed.png from drawable resource ID

由于ResourcesNotFoundException 而发生崩溃,这似乎是由上述堆栈跟踪中列出的文件引起的。

有没有人遇到过这个问题,如果有,解决方法是什么?

【问题讨论】:

它明确表示没有找到可绘制对象,请再次检查 @W4R10CK 这些drawables不是我项目的一部分。 common_google_signin_btn_text_light_focused.xml 的 id 有问题,请检查该问题。 我也遇到了同样的问题,还是没有解决办法。 这里有同样的问题,所以推荐的问题...看起来很老了,你找到解决方案了吗? 【参考方案1】:

gradle 文件中试试这个:

android   
    defaultConfig   
         vectorDrawables.useSupportLibrary = true  
          

并使用最新的buildToolsVersion '28.0.3'

【讨论】:

以上是关于即时运行和谷歌地图的问题的主要内容,如果未能解决你的问题,请参考以下文章

百度地图和谷歌地图的选择

谷歌地图 API 变化?

Xamarin 和谷歌地图上的不同距离

React.memo 不适用于功能组件和谷歌地图

角谷歌地图填充空间

利用高德地图显示google map