Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IncompatibleClassChangeError: interface not implemented

Tags:

java

android

From the android market, I got the following crash report. Which I haven't found while testing my app. The crash occurs in PasswordActivity class. I am sending the stack trace and the code. Can anyone suggest to me where the crash occurs and why this occurs?

Stack Trace

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)

My Code

public class PasswordActivity extends Activity implements Utilities { //Private Variables 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;
        }
    });
}

}

like image 734
AndroidDev Avatar asked Nov 13 '22 04:11

AndroidDev


1 Answers

I saw 2 reports on play store with IncompatibleClassChangeError: interface not implemented exception in Service class with log message containing onStartCommand(Unknown Source). I am using Eclipse to build the released application.

Fortunately, my roommate's phone encountered the same exception. After reading through the following link: What causes java.lang.IncompatibleClassChangeError?, the way I fixed it (at least on my roommate's phone) is by adding android-support-v4.jar to "libs" folder of the project and adding to build path. Then in the Project "Java Build Path" section under "Order and Export", exported the newly added jar file and removed selection for exporting "Android Private Libraries".

like image 59
kka Avatar answered Nov 16 '22 03:11

kka