Reputation: 6778
I get the following error when attempting to use the layout editor in Android Studio:
Rendering Problems The following classes could not be instantiated:
- com.mapbox.mapboxsdk.maps.widgets.MyLocationView
The code works fine, the map is shown. This is a problem strictly with the layout editor.
SSCCE on Github:
https://github.com/emnrd-ito/LayoutEditorRenderProblem
(Note though, that in order to run the code you would need to supply a Map Box access token in 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>
Edit: More info based on answer from @cammace:
Original dependencies:
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:4.1.1@aar') {
transitive = true
}
compile('com.mapbox.mapboxsdk:mapbox-android-services:1.3.1@aar') {
transitive = true
}
Changed to:
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:4.2.1@aar')
Still get the error.
Then changed to:
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.0.0-beta.1@aar')
I get errors like:
No resource found that matches the given name (at
textColor
with value @color/black`).
<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"/>
Upvotes: 0
Views: 149
Reputation: 3168
Your project seems to be using an outdated version of our SDK. This issue should be resolved in the latest stable and beta versions. Please upgrade to either 4.2.1
or 5.0.0-beta.1
and see if this fixes the issue.
Upvotes: 1