본문 바로가기
Android

[Android] 안드 오류 모음

by 준토리73 2023. 3. 7.

 

🚫 안드 개발하면서 가장 많이 접한 오류 

1. 

    java.lang.ClassCastException: com.google.android.material.button.MaterialButton cannot be cast to android.view.ViewGroup

참고) https://radix7318.blogspot.com/2018/02/caused-by-javalangclasscastexception.html

 

[안드로이드 스튜디오] Caused by: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.wi

 Caused by: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button ClassCastException 는 매칭하는 클래스...

radix7318.blogspot.com

2. 

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.database.sqlite.SQLiteDatabase.execSQL(java.lang.String)' on a null object reference
        at com.solbar.solbarim.OutOrderActivity$3.onClick(OutOrderActivity.java:106)

3.

java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

 

4. Layout xml 에 가장 큰 레이아웃 id 값을 설정안해줘서 ( id: area_main ) 

 java.lang.IllegalArgumentException: No view found for id 0x7f090214 (com.solbar.solbarim:id/area_main) for fragment OutOrderListFragment{f4ae16 #1 id=0x7f090214}

 

5. findViewById에서 NullPointerException

java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference

 

참고) https://swalloow.tistory.com/87

 

[안드로이드] Fragment에서 findViewById 에러 해결 방법

Fragment에서 findViewById error Fragment에서 바인딩을 위해 findViewById() 함수를 사용한다면 다음과 같은 오류가 발생합니다. java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.

swalloow.tistory.com

6.

 java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.IBinder android.view.View.getWindowToken()' on a null object reference

 

댓글