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"/>
感謝您的回覆。我已根據您的答案添加了信息。 –
由於某種原因,今天它可以正常工作。也就是說,在4.1.1中,我得到了4.2.2的錯誤。我不。 –