2017-02-09 110 views
0

试图使用布局编辑器Android Studio中,当我得到以下错误:布局编辑器渲染误差MapBox

Rendering Problems The following classes could not be instantiated: 
- com.mapbox.mapboxsdk.maps.widgets.MyLocationView 

的代码工作正常,地图显示。这是布局编辑器严格的问题。

SSCCE在Github上:
https://github.com/emnrd-ito/LayoutEditorRenderProblem
(不过请注意,为了运行代码,你需要在access_token提供一个地图框的访问令牌)

activity_main.xml中

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:mapbox="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/activity_main" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context="testdemo.com.layouteditorrenderproblem.MainActivity"> 

    <!-- NYC Union Square: 40.73581, -73.99155 --> 
    <com.mapbox.mapboxsdk.maps.MapView 
     android:id="@+id/mapView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     mapbox:center_latitude="40.73581" 
     mapbox:center_longitude="-73.99155" 
     mapbox:style_url="mapbox://styles/mapbox/streets-v9" 
     mapbox:zoom="17" /> 

</RelativeLayout> 

编辑: 更多的信息基于@cammace的答案:

原始依赖关系:

compile('com.mapbox.mapboxsdk:mapbox-android-sdk:[email protected]') { 
    transitive = true 
} 
compile('com.mapbox.mapboxsdk:mapbox-android-services:[email protected]') { 
    transitive = true 
} 

更改为:

compile('com.mapbox.mapboxsdk:mapbox-android-sdk:[email protected]') 

仍然得到错误。

则改为:

compile('com.mapbox.mapboxsdk:mapbox-android-sdk:[email protected]') 

我得到这样的错误:

没有资源发现在给定的名字(与 值@色/ black`在textColor)相匹配。

<TextView 
    android:text="@string/app_name" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/about_app_name" 
    android:textStyle="bold" 
    android:textColor="@color/black" 
    android:textSize="@dimen/text_size_xxl"/> 

回答

1

您的项目好像是用我们的SDK版本已过期。这个问题应该在最新的稳定版和测试版中解决。请升级到4.2.15.0.0-beta.1,看看这是否解决了这个问题。

+0

感谢您的回复。我已根据您的答案添加了信息。 –

+0

由于某种原因,今天它可以正常工作。也就是说,在4.1.1中,我得到了4.2.2的错误。我不。 –