2016-06-15 7 views
5

を発見していない私はNestedScrollViewでScrollViewを交換し、今私はエラー - NestedScrollView - クラスのAndroid Studioの2.1.2、Windows 7の</p> <p>を実行

android.view.InflateExceptionを取得しています:バイナリXMLファイルのライン#2:エラー 膨張クラスNestedScrollView

にjava.lang.ClassNotFoundException:パス上のクラス "android.view.NestedScrollView" を見つけることができませんでした: /data/app/com.assemblyguide.remote -48 .apk

...そのXMLファイルでSetContentView()を呼び出したとき。私はScrollViewだけを持っていたときにそれを取得しませんでした。

私はクリーニングを試みて、キャッシュを無効にして再構築しました。 XMLはこのように見えます。 。 。

<?xml version="1.0" encoding="utf-8"?> 
<NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <!-- This linear layout is because the scrollview can have only 1 direct child --> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 

     <!-- Relative layout for Workorder --> 
     <RelativeLayout 
      android:id="@+id/rellayWorkorder" 
      android:background="#383838" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="30dp" 
      android:layout_marginBottom="2dp"> 
      <TextView 
       android:id="@+id/workorderlabel" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_margin="2dp" 
       android:gravity="left" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="Work Order:"/> 

      <TextView 
       android:id="@+id/workorderContent" 
       android:layout_width="150dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentRight="true" 
       android:layout_margin="2dp" 
       android:gravity="right" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="---workorder---"/> 
     </RelativeLayout> 


     <!-- Relative layout for Required Time 
    <FrameLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center_horizontal"></FrameLayout> --> 

     <RelativeLayout 
      android:id="@+id/rellayRequiredTime" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="30dp" 
      android:layout_marginBottom="2dp"> 
      <TextView 
       android:id="@+id/requiredTimelabel" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_margin="2dp" 
       android:gravity="left" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="Required Time:"/> 

      <TextView 
       android:id="@+id/requiredTimeContent" 
       android:layout_width="150dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentRight="true" 
       android:layout_margin="2dp" 
       android:gravity="right" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="--- 00 minutes ---"/> 
     </RelativeLayout> 

     <!-- Relative layout for Time remaining --> 
     <RelativeLayout 
      android:id="@+id/rellayTimeRemaining" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="30dp" 
      android:layout_marginBottom="2dp"> 
      <TextView 
       android:id="@+id/timeremaininglabel" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_margin="2dp" 
       android:gravity="left" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="Time Remaining:"/> 

      <TextView 
       android:id="@+id/tviewtimeremainingContent" 
       android:layout_width="150dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentRight="true" 
       android:layout_margin="2dp" 
       android:gravity="right" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="--- 0:00:00---"/> 
     </RelativeLayout> 

     <!-- Linear layout for Record Start/Record End buttons --> 
     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" > 
      <Button 
       android:id="@+id/debulkrecordStart" 
       android:layout_width="150dp" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="6dp" 
       android:layout_marginRight="4dp" 
       android:gravity="center" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:onClick="OnSetRecordStartTimeClick" 
       android:text="Record Start"/> 
      <Button 
       android:id="@+id/debulkrecordEnd" 
       android:layout_width="150dp" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="6dp" 
       android:layout_marginRight="4dp" 
       android:gravity="center" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:onClick="OnSetRecordEndTimeClick" 
       android:text="Record End"/> 
     </LinearLayout> 

     <!-- Relative layout for Vacuum level --> 
     <RelativeLayout 
      android:id="@+id/rellayvacuumlevel" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="2dp"> 
      <TextView 
       android:id="@+id/vaclabel" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_margin="2dp" 
       android:gravity="left" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:text="Vacuum Level (inches Hg):"/> 
      <EditText 
       android:id="@+id/vacleveledit" 
       android:layout_width="120dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentRight = "true" 
       android:layout_margin="2dp" 
       android:gravity="left" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:inputType="text|textCapCharacters" 
       android:text="vac level" 
       android:layout_marginRight="2dp" 
       android:layout_marginTop="2dp" 
       android:layout_marginBottom="2dp"/> 
     </RelativeLayout> 

     <!-- Relative layout for Vac Gauge Equipment # --> 
     <RelativeLayout 
      android:id="@+id/rlayvacuumGauge" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="2dp"> 
      <TextView 
       android:id="@+id/vacgaugelabel" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_margin="2dp" 
       android:gravity="left" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:text="Vac Gauge Equipment #:"/> 
      <EditText 
       android:id="@+id/vacgaugeedit" 
       android:layout_width="120dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentRight = "true" 
       android:layout_margin="2dp" 
       android:gravity="left" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:inputType="text|textCapCharacters" 
       android:text="equip. #"/> 
     </RelativeLayout> 



     <!-- Relative layout for Calibration Due date --> 
     <RelativeLayout 
      android:id="@+id/rlaycalibdue" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="2dp"> 
      <TextView 
       android:id="@+id/calibduelabel" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_margin="2dp" 
       android:gravity="left" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:text="Calibration Due Date:"/> 
      <EditText 
       android:id="@+id/calibdueedit" 
       android:layout_width="120dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentRight = "true" 
       android:layout_margin="2dp" 
       android:gravity="left" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:inputType="text|textCapCharacters" 
       android:text="mm/dd/yyyy"/> 
     </RelativeLayout> 


     <CalendarView 
      android:id="@+id/debulkcalendar" 
      android:layout_width="300dp" 
      android:layout_height="250dp" 
      android:minDate="01/01/2016" 
      android:maxDate="11/30/2016" 
      /> 


     <!-- this linear layout is for the debulk override and done buttons --> 
     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" > 
      <Button 
       android:id="@+id/debulkOverride" 
       android:layout_width="150dp" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="6dp" 
       android:layout_marginRight="4dp" 
       android:onClick="OnResetClick" 
       android:gravity="center" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="Override"/> 
      <Button 
       android:id="@+id/debulkDone" 
       android:layout_width="150dp" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="6dp" 
       android:layout_marginRight="2dp" 
       android:onClick="onDoneBtnClick" 
       android:gravity="center" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="Done"/> 
     </LinearLayout> 

    </LinearLayout> 

</NestedScrollView> 

このエラーは何を意味し、どのように修正しますか?

答えて

17

フルクラス名はandroid.support.v4.widget.NestedScrollViewです。 <NestedScrollView>要素を<android.support.v4.widget.NestedScrollView>に置き換えると正常に動作します。 build.gradleファイルにもv4サポートライブラリがあることを確認してください。

+0

おかげだが、私はまだ理解していないと述べて:なぜ、このフラグは、エラーません**ビルド時のXML **?また、サポートライブラリとは何ですか?つまり、サポートライブラリと通常のAndroidクラスの違いは何ですか? – user316117

+0

サポートライブラリは、後で追加された特定のアンドロイド機能のバックポートです。たとえば、 'Toolbar'ウィジェットがv21に追加されました。これは、アプリでツールバーを使用したい場合、minSdkは21である必要があることを意味します。minSdkが7のツールバーを使用できるようにする 'android.support.v7.widget.Toolbar'の実装があります。再ビルド時間xmlエラーではわかりませんが、Android Studioを使用している場合は[デザイン]タブをクリックするとエラーが表示されます。 – chessdork

6

あなたは依存関係にこの行を追加する必要があります。

また
compile 'com.android.support:support-v4:23.4.0' 

chessdorkはそれがandroid.support.v4.widget.NestedScrollViewないNestedScrollView

+0

「依存関係」はどこですか? – user316117

+0

android studioを使用している場合は、build.gradleファイルにあります –

関連する問題