-
java.lang.NoSuchMethodException: ...<init>(...)Android/Error 2021. 3. 18. 16:13반응형
java.lang.NoSuchMethodException: dev.dnights.baseViewHolder.<init> (android.view.View)
java 또는 kotlin 에서 getDeclaredConstructor() 를 이용해서 class를 생성할때 위와 같은 에러가 발생할경우
해당 생성자가 있는지 확인하고 proguard 나 dexguard 를 사용하고 있다면
아래의 예제처럼 예외처리를 하고 있는지 확인하여야 한다.
-keepclassmembers class * extends dev.dnights.BaseViewHolder { <init>(android.view.View); }
[참고링크]
Constructor 클래스의 getConstructor 와 getDeclaredConstructor 차이 비교
우선 Constructor 클래스중에 getConstructor 혹은 getDeclaredConstructor 메소드를 호출할 때 발생하는 예외인 NoSuchMethodException 을 알아보자. 아래와 같이 프로젝트 하나 만들고 패키지도 2개 만들어 주자..
emflant.tistory.com
stackoverflow.com/questions/38653990/pro-guard-keep-private-constructor
pro guard keep private constructor
I am using Kofax in our project, and it uses a lot of Reflection and Robogiuice. We are using Dexguard to obfuscate our code. One of the problems we have is the private constructor was stripped. I
stackoverflow.com
반응형'Android > Error' 카테고리의 다른 글