问题
I am trying to restructure an existing app so that, except for a few override-able methods in a derived activity, all code will reside in a library. This still doesn't work for some reason, but in the process of attempting to troubleshoot this, I discovered much to my dismay that there are two .apk files installed, not one (when I run a debug session from eclipse):
- The first (and larger file) is having the original library name.
- The second (only 20KB in size) is having the derived application name.
Why is that and where can I learn more about this?
Could that explain the ClassNotFoundException problem I am having?
回答1:
I found the answer myself. It turns out that I had 2 critical settings in the Properties of both projects not set correctly:
- 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.
- In the application project, I neglected to add my library project as a reference via the Add... button. (how dumb could I be?)
Hoping this can be useful for other newbies to come.
来源:https://stackoverflow.com/questions/6332871/library-based-application-installs-2-apk-files-not-one-why