2014-06-27 2 views
71

Mam dziwny problem z nową wersją ADT. Pobrałem nową wersję Eclipse z wersji eclipse.org, a następnie zainstalowałem na niej narzędzie ADT. Wszystko dziala; Mogę stworzyć projekt dla Androida i wszystkie rzeczy pracy dobrze, z wyjątkiem:Wystąpił wyjątek podczas renderowania: java.lang.System.arraycopy

Kiedy próbuje utworzyć jeden układ xml, pojawia się następujący błąd:

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

aw Error Log widać:

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

Ff Zmieniam EditText na TextView, błąd zniknie. Mogę uruchomić swój program nawet z tym ostrzeżeniem, ale chcę zobaczyć mój układ w sekcji graficznej.

Mój układ jest:

<?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> 

Szukałem odpowiedzi tutaj, ale nie znaleźliśmy żadnych. Jak mogę to naprawić?

PS: Ten problem zdarzył się w ADT 23 - próbowałem go z ADT 22,6 i działało dobrze.

+0

używasz wysokiego poziomu zagnieżdżonych wag. zagnieżdżone ciężary są szkodliwe dla wydajności. To może być przyczyną –

+0

Nie sądzę, że @IllegalArgument, ponieważ jak powiedziałem, jeśli używam problem TextView już nie istnieje. tak czy inaczej można utworzyć ten układ bez użycia wysokiego poziomu zagnieżdżonych wag? –

+0

Czy próbowałeś wyczyścić swój projekt? może plik R. jest uszkodzony? – erik

Odpowiedz

223

ten problem zdarzył się na API 20 (Android 4.4 W) Ostatnio miałem z tym problem, ale problem zostanie rozwiązany przez zmianę wersji Androida, aby użyć do renderowania poziomu postaci API 20 (Android 4.4 W) do API 19 (Android 4.4 0,2) (android ikona w prawym górnym rogu układu graficznego) lub zaktualizować do Android SDK API 20 L (L preview)

ekranu ujęcia:

enter image description here

+0

na moim komputerze, wznowiłem uruchamianie Androida Studio, następnie opcja pokazana dla API 20 Android L (i można dodać pole tekstowe bez błędu) – tmr

+0

Aktualizacja 2016: To rozwiązało problem idealnie dla mnie. Android N (Preview) był domyślny dla nowej instalacji Androida Studio. Przejście do interfejsu API 23 spowodowało, że ekran się poprawił. – RobertB

6

miałem ten sam problem z 20 (4,4 W), ale zniknął, gdy zainstalowałem i wybrałem 20 (4,4 L (podgląd)). Jest tak prawdopodobnie dlatego, że 4.4W to Android Wear SDK, więc może nie obsługiwać wszystkich funkcji standardowego telefonu/tabletu. Android

21

Android Wear to zegarek na rękę, którego nie można wpisać, więc nie można używać EditText w wersji 4.4 W. Zmień interfejs API na 19 lub mniej lub zmień go na 4.4L, który można pobrać z Menedżera SDK. To nie jest błąd.

5

@shayan pourvatan już odpowiedział na to pytanie właściwie dla mnie, ja właśnie dodam te dwa obrazy opisujące jak zainstalować wersję API 20 L, aby użyć jej jako renderera podglądu.

enter image description here

enter image description here

2

Można zaktualizować 4,4 W SDK do 4.4W2 SDK. To naprawiło moje.