Android: Unable to instantiate activity / ClassNotFoundException

前端 未结 30 3132
粉色の甜心
粉色の甜心 2020-11-27 13:46

I recently published an app to the market and I\'m now getting an error by some user, the app presumably crashes right when it starts. Unfortunately I can\'t contact him dir

30条回答
  •  眼角桃花
    2020-11-27 14:22

    I had the same issue in a recent Android project. The problem turned out to be pretty simple yet it was hard to locate. This happened to me then I refactored the package name of the entry point activity of the app. This created a conflict with the gen/.../R.java file, since the package there was not refactored. Eclipse did not complain, but at runtime i got the same error you posted: could not instantiate... classNotFoundException...

    Lesson learned from this: do NOT refactor the package name that holds your main activity!

    Hope this helps you or anyone breaking his/her head over this error!

提交回复
热议问题