2017-09-06 2 views
0

私は問題を抱えていますが、1つ以上のクラスのインスタンス化に失敗しました。下位クラスはインスタンス化できません。そこ android.support.v7.widget.AppCompatTextviewandroid.support.v7.widget.AppCompatTextview instataniateに失敗しました

<?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="wrap_content" 
android:layout_marginTop="16dp" 
android:orientation="horizontal"> 

<de.hdodenhof.circleimageview.CircleImageView 
    android:id="@+id/iv_comment_owner_display" 
    android:layout_width="20dp" 
    android:layout_height="20dp" 
    android:src="@drawable/facebook" /> 

<LinearLayout 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="16dp" 
    android:layout_marginRight="16dp" 
    android:layout_weight="1" 
    android:orientation="vertical"> 

    <TextView 
     android:id="@+id/tv_username" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="Username" 
     android:textColor="@android:color/black" 
     android:textStyle="bold" /> 

    <TextView 
     android:id="@+id/tv_comment" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="4dp" 
     android:text="" 
     android:textColor="@android:color/black" /> 

</LinearLayout> 


</LinearLayout> 
+0

https://stackoverflow.com/questions/26575815/the-following-classes-could-not-be-instantiated-android-support-v7-widget-too –

+0

これらのすべてのアンサーは私のために働いていませんでした@IntelliJAmiya –

答えて

0

AppCompatTextViewAPPCOMPAT-V7で追加された私のxmlファイルです:22.1.0

あなたはAPPCOMPATご確認くださいバージョン。これでグラデルファイルを更新する必要があります。

+0

com.android.support:appcompat-v7:26.0.2 –

0

Androidスタジオからプロジェクトをクリーン/再ビルドすると、役立つ可能性があります。 キャッシュを無効にしてアンドロイドスタジオを再起動しない場合。

+0

これらのことをすべて試してみてください:(@himel –

0

あなたは、あなたのbuild.gradle(モジュール:APP)に依存関係を追加 てみてください行っていない場合は のアプリに応じてバージョンを確認してください

dependencies { 

compile 'com.android.support:design:25.3.1' 

}

+0

私は既にこの依存関係を使用しています –

0

を入れてみてくださいあなたのレイアウトのこのコード

 <android.support.v7.widget.AppCompatTextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="Hello world" 
     android:textSize="18dp" 
     /> 

私はAppCompatTが見えないのであなたのレイアウトのextView。

関連する問題