【发布时间】:2012-05-18 04:36:53
【问题描述】:
我使用默认设置将 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:找不到方法 onClick 处理程序的活动类 xxxx 中的 onSaveButtonClick(View) 在 id 为 'xxxxx' 的视图类 android.widget.Button 上
你知道为什么会这样吗?
【问题讨论】:
-
你见过this thread吗?