gpt4 book ai didi

java - IncompatibleClassChangeError : interface not implemented

转载 作者:太空宇宙 更新时间:2023-11-03 10:52:47 28 4
gpt4 key购买 nike

从 android 市场,我得到以下崩溃报告。我在测试我的应用程序时没有找到。崩溃发生在 PasswordActivity 类中。我正在发送堆栈跟踪和代码。谁能告诉我崩溃发生在哪里以及为什么会发生?

堆栈跟踪

java.lang.IncompatibleClassChangeError: interface not implemented
at in.plackal.lovecyclesfree.PasswordActivity.onCreate(PasswordActivity.java)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
at dalvik.system.NativeStart.main(Native Method)

我的代码

public class PasswordActivity extends Activity implements Utilities {//私有(private)变量private EditText m_passwrdEditText;

private TextView m_passwrdErrorText;

private Resources m_res;

@Override
public void onCreate(Bundle savedInstanceState) {
//Setup the activity
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);


if (dm.widthPixels == 320 && dm.heightPixels == 480) {
setContentView(R.layout.password_activity_hvga);
} else {
setContentView(R.layout.password_activity);
}

GoogleAnalyticsTracker tracker = GoogleAnalyticsTracker.getInstance();;
tracker.startNewSession("UA-xxxxxxx-1", this);
tracker.trackPageView("Password");
tracker.dispatch();

m_res = getResources();

final Typeface face = Typeface.createFromAsset(getAssets(), "fonts/Cicle Semi.otf");

m_passwrdErrorText = (TextView) findViewById(R.id.txt_error_message);
m_passwrdErrorText.setTypeface(face);

m_passwrdEditText = (EditText) findViewById(R.id.txt_edit_passwrd);
m_passwrdEditText.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
m_passwrdEditText.setHint("");
m_passwrdEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
m_passwrdEditText.setTypeface(face);
}
});

m_passwrdEditText.setTypeface(face);

m_passwrdEditText.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
String strPassEntered = m_passwrdEditText.getText().toString();
String strPassSaved = CycleManager.getSingletonObject().getPassWord();
m_passwrdEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
if (strPassSaved.equals(strPassEntered) || strPassEntered.equals(DEFAULT_PASSWORD)) {
Intent intent = new Intent(PasswordActivity.this, ActivityManager.class);
startActivity(intent);
PasswordActivity.this.finish();
} else {
m_passwrdErrorText.setText(m_res.getString(R.string.passwrd_error_text));
m_passwrdEditText.setFocusable(true);
}
} else if (keyCode == KeyEvent.KEYCODE_DEL) {
m_passwrdEditText.setHint(m_res.getString(R.string.passwrd_hint_text));
m_passwrdErrorText.setText("");
}

m_passwrdEditText.setTypeface(face);
return false;
}
});
}

最佳答案

我看到 2 份关于 Play 商店的报告,IncompatibleClassChangeError: interface not implemented exception in Service class with log message containing onStartCommand(Unknown Source) .我正在使用 Eclipse 构建已发布的应用程序。

还好我室友的手机也遇到了同样的异常。通过以下链接阅读后:What causes java.lang.IncompatibleClassChangeError? ,我修复它的方法(至少在我室友的手机上)是将 android-support-v4.jar 添加到项目的“libs”文件夹并添加到构建路径。然后在“订购和导出”下的项目“Java 构建路径”部分中,导出新添加的 jar 文件并删除导出“Android 私有(private)库”的选择。

关于java - IncompatibleClassChangeError : interface not implemented,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10797551/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com