2012-05-17 3 views
2

기본 설정을 사용하여 Android 프로젝트에 ProGuard를 추가했는데 코드가 깨졌습니다. 첫 화면에서 ProGuard가 내 Android 코드를 파손했습니다.

는,이 같은 버튼이 있습니다

<Button 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:onClick="onSaveButtonClick" /> 

을 그리고 클래스의 방법이 있습니다

public void onSaveButtonClick(View view){ 
// some code 
} 

ProGuard에서 장애인, 모든 것이 잘 작동합니다.

05-17 16:04:54.099: E/AndroidRuntime(1181): java.lang.IllegalStateException: Could not find a method onSaveButtonClick(View) in the activity class xxxx for onClick handler on view class android.widget.Button with id 'xxxxx'

어떤 아이디어 왜 이런 일이 : 활성화되면 버튼을 클릭에 나는이 오류가?

+1

[이 스레드] (http://stackoverflow.com/questions/7796190/androidonclick-not-working-with-proguard) 보셨습니까? – keyser

답변

3

Proguard는 "onSaveButtonClick"메서드를 "a"와 같은 것으로 변경합니다. Android에서 더 이상 찾을 수 없도록 XML 파일을 업데이트하지 않습니다. 클릭 핸들러를 프로그래밍 방식으로 (뷰의 setOnClickListener 사용) 설정하거나 Keyser가 게시 한 SO 질문에 링크 된 조언을 따르십시오.

관련 문제