71

I have a Strange problem with the new ADT version. I have downloaded the new Eclipse from eclipse.org then I install ADT on it. Everything works fine; I can create a project for android and all thing work well, except:

When trying to create one xml layout, I get the following error:

Exception raised during rendering: java.lang.System.arraycopy

and in the Error Log I see:

Failed to render set of icons for AnalogClock, AutonCompleteTextView, button, SmallButton , ....

Ff I change EditText to TextView, the error disappears. I can run my program even with this warning, but I want to see my layout in graphical section.

My layout is:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/settingback"
    android:orientation="vertical"
    android:weightSum="480" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="50"
        android:gravity="right"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/close"
            android:layout_width="50dp"
            android:layout_height="match_parent"
            android:background="#00000000" />
    </LinearLayout>

    <View
        android:id="@+id/view1"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_weight="20" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="40"
        android:orientation="horizontal"
        android:weightSum="320" >

        <View
            android:id="@+id/view8"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="40" />

        <EditText
            android:id="@+id/textView1"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="240"
            android:gravity="center|right"
            android:background="#00000000"/>

        <View
            android:id="@+id/view9"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="40" />
    </LinearLayout>

    <View
        android:id="@+id/view2"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="20" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="35"
        android:orientation="horizontal" >

        <View
            android:id="@+id/view10"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="40" />

        <EditText
            android:id="@+id/textView2"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="240"
            android:gravity="center|right"
            android:background="#00000000" />

        <View
            android:id="@+id/view11"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="40" />
    </LinearLayout>

    <View
        android:id="@+id/view3"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_weight="10" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="35"
        android:orientation="horizontal" >

        <View
            android:id="@+id/view12"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="40" />

        <EditText
            android:id="@+id/textView3"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="240"
            android:gravity="center|right"
            android:background="#00000000"/>

        <View
            android:id="@+id/view13"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="40" />
    </LinearLayout>

    <View
        android:id="@+id/view4"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_weight="105" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="40"
        android:orientation="horizontal" >

        <View
            android:id="@+id/view14"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="40" />

        <EditText
            android:id="@+id/textView4"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="240"
            android:gravity="center|right"
            android:background="#00000000" />

        <View
            android:id="@+id/view15"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="40" />
    </LinearLayout>

    <View
        android:id="@+id/view5"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="5" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="40" >

        <View
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="40"
             />

        <EditText
            android:id="@+id/textView6"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="240"
            android:gravity="center|right"
            android:background="#00000000" />

        <View
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="40" />
    </LinearLayout>

    <View
        android:id="@+id/view6"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="20" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="30"
        android:orientation="horizontal"
        android:weightSum="320" >

        <View
            android:id="@+id/view16"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="90" />

        <CheckBox
            android:id="@+id/shake"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:layout_weight="70"
            android:gravity="center" />

        <View
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="10" />

        <CheckBox
            android:id="@+id/ring"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:layout_weight="70"
            android:gravity="center" />

        <View
            android:id="@+id/view17"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="80" />
    </LinearLayout>

    <View
        android:id="@+id/view7"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="30" />

</LinearLayout>

I searched for an answer here but didn't find any. How can I fix this?

PS: This problem happened on ADT 23 - I tried it with ADT 22.6, and it worked well.

Rookie Programmer Aravind
  • 11,952
  • 23
  • 81
  • 114
  • you are using high level of nested weights. nested weights are bad for performance. That might be the cause – Illegal Argument Jun 27 '14 at 12:10
  • i don't think so @IllegalArgument because as i said if i use TextView problem has been gone. anyway how can create this layout without using high level of nested weights? –  Jun 27 '14 at 12:12
  • did you try cleaning your project? maybe the R. file is corrupt? – erik Jun 27 '14 at 12:17
  • yes @erik I tried cleaning and all other thing, –  Jun 27 '14 at 12:19
  • perhaps because your weightSum is wrong (I've never used weightSum so...) – Graeme Jun 27 '14 at 12:48
  • @Graeme thanks for your reply, no it's not a problem even if that is the problem why this worked with TextView ? –  Jun 27 '14 at 12:50
  • Try API 4.4.2. To install different APIs see [here](http://stackoverflow.com/questions/12141169/how-to-install-android-4-0-api-14-in-eclipse)! – user3614158 Jul 09 '14 at 02:46

5 Answers5

223

this problem happened on API 20 ( Android 4.4 W ) I recently have a problem with that but Problem will be solved by changing Android version to use for rendering level form API 20 ( Android 4.4 W ) to API 19 (Android 4.4.2) ( android icon in top right corner of graphical layout ) or update your SDK to Android L ( API 20 L preview )

Screen Shot :

enter image description here

Shayan Pourvatan
  • 11,898
  • 4
  • 42
  • 63
  • on my machine, took rebooting android studio, then option showed for API 20 Android L (and can add text field without error) – tmr Oct 05 '14 at 21:17
  • 2016 update: This solved the problem perfectly for me. Android N (Preview) was the default for a new installation of Android Studio. Changing to API 23 brought the screen right up. – RobertB Mar 21 '16 at 02:49
21

Android Wear is a wrist watch and you cannot type anything in it so you cannot use EditText on 4.4W. Change the API to 19 or less or change it to 4.4L which can be downloaded from SDK Manager. This is not a bug.

Bill Gates
  • 305
  • 1
  • 9
6

I was having this same problem with 20 (4.4W), but it disappeared when I installed and chose 20 (4.4 L (preview)). This is probably because 4.4W is the Android Wear SDK, and so may not support all the features of standard phone/tablet Android

Ky -
  • 30,724
  • 51
  • 192
  • 308
5

@shayan pourvatan already answered this question properly for me, i am just adding those two images describing how to install the API 20 L Version to use it then as the Preview renderer.

enter image description here

enter image description here

user1767754
  • 23,311
  • 18
  • 141
  • 164
2

You could update your 4.4W SDK to 4.4W2 SDK. That fixed mine.

6kgstront
  • 33
  • 7