상세 컨텐츠

본문 제목

[안드로이드 프로그래밍] - 안드로이드 스튜디오 오류 : Caused by: android.view.InflateException: Binary XML file line #,Caused by: java.lang.NoSuchMethodException:<init> [class android.content.Context, interface android.util.Attribute..

프로그래밍/안드로이드 프로그래밍

by 발랄하고 우울한 청춘 2016. 1. 28. 22:18

본문

728x90
반응형
SMALL

 

 


 

 

안드로이드 프로그래밍

안드로이드 스튜디오 오류

Caused by: android.view.InflateException: Binary XML file line #

 

Caused by: java.lang.NoSuchMethodException:

<init> [class android.content.Context, interface android.util.AttributeSet]

 

 

 


 

 

 

 

 

 

안드로이드 스튜디오로 프로그래밍 하던 중,

라이브러리 추가하면서 한~참 충돌나는거 잡던 중 생긴 오류

(나중에 보니 이오류는 날 필요도 없는 오류였었다 ㄸㄹㄹ)

 

java.lang.RuntimeException: Unable to start activity ComponentInfo

 

Caused by: android.view.InflateException: Binary XML file line #203: Error inflating class 패키지명.클래스명

 

Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]

 그렇게 구글님과 다시 심도있는 대화를 해본 결과, 원인은 두가지!


1. 클래스 파일 경로 문제

2. 생성자 문제


둘다 복합적인 거라서 클래스 파일 경로 다시 확인하고,

생성자를 추가 생성하였다

 

public class TestEdit extends View {


   
public TestEdit (Context context, AttributeSet attrs, int defStyle) {
       
super(context, attrs, defStyle)
;
   
}

}

 

이렇게 하나의 생성자만 있던 것을

아래와 같이 추가해주니 오류 해결 !

 

public class TestEdit extends View {

   
public TestEdit (Context context,
AttributeSet attrs) {
       
super(context, attrs)
;
   
}

   
public TestEdit (Context context, AttributeSet attrs, int
defStyle) {
       
super(context, attrs, defStyle)
;
   
}

}

 

 

 

반응형
LIST

관련글 더보기

댓글 영역