Unable to instantiate activity… Caused by ClassNotFoundException

前端 未结 4 951
无人及你
无人及你 2020-12-17 23:46

After converting a perfectly working application to a library (including its Activity class!), I am trying to create an application that uses that entire library by simply s

相关标签:
4条回答
  • 2020-12-17 23:46

    For anyone who updated to ADT 22, make sure that you have checked Android Private Libraries in the Java Build Path > Order and Export tab. For further information, read this. This works for me. Maybe little force to move users to Android Studio instead of Eclipse:))

    0 讨论(0)
  • 2020-12-17 23:59

    This can happen if you list the activities in the library manifest instead of in the application manifest. There's no need to have <activity> tags in a library manifest. (See, for instance, this thread.)

    0 讨论(0)
  • 2020-12-18 00:10

    I had the same error in one of my projects and thought that I can share how I fixed mine.

    At some point of my project I had to change one of the package names I am using where all my Activity classes are situated. When I did, I forgot to update the AndroidManifest which caused me the same error. Updating this fixed it.

    0 讨论(0)
  • 2020-12-18 00:13

    I finally solved the problem. It turns out that I had 2 critical settings in the Properties of both projects not set correctly:

    1. In the library project, "Is Library" was not checked for some reason. I could swear that I checked it, but knowing how whimsical the Android development environment under Eclipse can be, I suspect that it was unchecked by Eclipse (or the ADT plugin) as a result of some glitch.
    2. In the application project, I neglected to add my library project as a reference via the Add... button. (how dumb could I be?)

    I hope that other newbies like me will find this information helpful. Sometimes, an extremely difficult problem to debug, hides a configuration error when the innocent unsuspecting stressed programmer assumes that this is already has been taken care of...

    0 讨论(0)
提交回复
热议问题