Rendering problems Rendering exception: color and position arrays must be the same length

Hi, I am getting rendering errors in android studio. Does anyone know why this is caused?

My xml:

<!-- ListRow Left side Thumbnail image --> <LinearLayout android:id="@+id/thumbnail" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_marginRight="5dip" android:background="@drawable/image_bg" android:padding="0dip" > <ImageView android:id="@+id/list_image" android:layout_width="50dip" android:layout_height="50dip" android:scaleType="centerCrop" /> </LinearLayout> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/thumbnail" android:layout_marginTop="0dip" android:layout_toRightOf="@+id/thumbnail" android:text="De Titel van het geweldige bericht" android:textColor="#60a926" android:textSize="15dip" android:textStyle="bold" android:ellipsize="end" android:typeface="sans" /> <TextView android:id="@+id/subtitle" android:layout_width="match_parent" android:layout_height="25dp" android:layout_below="@id/title" android:layout_marginTop="0dip" android:layout_toLeftOf="@+id/imageView1" android:layout_toRightOf="@+id/thumbnail" android:text="Nieuwsbericht subtitel mooi iets ..." android:textStyle="bold" android:ellipsize="end" android:textColor="#9f9e9f" android:textSize="10dip" /> <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:src="@drawable/arrow" /> <!-- datum van bericht --> <TextView android:id="@+id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/artist" android:layout_alignTop="@+id/imageView1" android:layout_marginTop="18dp" android:layout_marginLeft="175dp" android:gravity="right" android:text="" android:textColor="#ffffff" android:textSize="10dip" android:textStyle="bold" /> </RelativeLayout> 

When I use Preview, I get this error:

 "Rendering Problems Exception raised during rendering: color and position arrays must be of equal length" 

Is this an Android Studio bug, or am I doing something wrong?

I hope someone has a solution.

+6
source share
4 answers

I solved it. The problem was caused by using a false gradient style file. Removing the gradient file solved the problem for me.

+3
source

Disable first Automatically select the best feature. (You can see in the image below)

Then select the Api preview version to render

That’s all worked for me :)

enter image description here

This answer is also given to fix problems when using a non-updated version of Build Tools for rendering. Another way to fix the problem:

Open the SDK Manager and upgrade the Build Tools version to the Preview Channel if you want to use the Preview version of Build Tools when rendering.

+16
source

I solved this problem by removing the preview in the pre-sale version of Android. Like Android N.

It also helps.

+3
source

Today is April 14, 2015 (April 15, 14). "Elimination of problems when creating a rendering"

Here is what worked for me.

Android Manager Android SD uploaded 19, 19.1, 22 and 24.1.2. 22.0.0 is not listed in my SDK manager. I double-clicked "build.gradle (module application) in the" Gradle Scripts "section in Android Studio and changed the line

compile 'com.android.support:appcompat-v7:22.0.0 to' in compile 'com.android.support:appcompat-v7:19.1'

Then, in the drop-down menu above the renderer next to small Android (called "Android version to use ..." the drop-down menu with the mouse pointer), I selected "API 19: Android 4.4.2".

Rendered.

Earlier in the same script version and build tool version, the value 19 was set:

buildToolsVersion "19.1.0"

targetSdkVersion 19

+2
source

Source: https://habr.com/ru/post/951032/


All Articles