java library vs android library
what are the differences between Java lib开发者_开发知识库rary and android library and what advantages/disadvantages has each?
You can include standard Java .jar file libraries in an Android app. They are translated into Dalvik format at .apk build time.
There is an Android Library system which allows the use of shared resources such as layouts and localized strings. As that has more restrictions that regular Java libraries I'd only recommend this method if you actually need to share resources.
http://developer.android.com/guide/developing/projects/projects-eclipse.html
I imagine you meant the android API (or SDK, I can't say) and java API (or SDK). Basically, android is based on java. It is a subset of it, but also adds specific classes and methods to interact with the hardware and the android OS, implement UI, etc.
You can find info about the android architecture here: http://developer.android.com/guide/basics/what-is-android.html
Concerning advantages/disadvantages, well, if you're developing for the android operating system, then is a great advantage to use the android API. If you're developing for PCs, then part of the android API won't be supported, which is what I would call a disadvantage...
In sum, you need to choose whether to use the andoid API or not depending on what will you be coding: will the API be supported by the OS? Is there a JVM for it?
It is very important to know that serialization of classes shared between the two is supported. But they must be located in a package with the same name in both projects.
精彩评论