0

我需要在我的 selectuser 类中调用类数据当用户从微调器中选择任何项目时我正在使用它

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    int icon = imgid1[userspinner.getSelectedItemPosition()];
    prefs.edit().putInt("userposition", icon).commit();
    data d = new data();
    data d1 = d.Accept(userspinner.getSelectedItemPosition());
    current.setText(d1.getWeapon_pack());
}

它显示错误

data d = new data();

这是堆栈跟踪

06-05 11:29:43.796 3011-3011/com.pttest.com.pockettankstips E/AndroidRuntime: FATAL EXCEPTION: main
                                                                          Process: com.pttest.com.pockettankstips, PID: 3011
                                                                          java.lang.VerifyError: Rejecting class com.pttest.com.pockettankstips.data because it failed compile-time verification (declaration of 'com.pttest.com.pockettankstips.data' appears in /data/app/com.pttest.com.pockettankstips-2/base.apk)
                                                                              at com.pttest.com.pockettankstips.selectuser.onItemSelected(selectuser.java:455)
                                                                              at android.widget.AdapterView.fireOnSelected(AdapterView.java:897)
                                                                              at android.widget.AdapterView.access$200(AdapterView.java:48)
                                                                              at android.widget.AdapterView$SelectionNotifier.run(AdapterView.java:865)
                                                                              at android.os.Handler.handleCallback(Handler.java:739)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                              at android.os.Looper.loop(Looper.java:135)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5221)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at java.lang.reflect.Method.invoke(Method.java:372)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
4

1 回答 1

0

我不确定这是否会对您有所帮助,但我在开始新活动时收到了相同的错误消息。在 Android Studio 首选项中禁用“即时运行”会使此错误消失。

设置屏幕截图

于 2016-07-06T13:46:04.413 回答