eclipse java库vs安卓库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5622370/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 16:08:45  来源:igfitidea点击:

java library vs android library

javaandroideclipse

提问by Buda Gavril

what are the differences between Java library and android library and what advantages/disadvantages has each?

Java 库和 android 库之间有什么区别,各自有什么优点/缺点?

采纳答案by Jim Blackler

You can include standard Java .jar file libraries in an Android app. They are translated into Dalvik format at .apk build time.

您可以在 Android 应用程序中包含标准 Java .jar 文件库。它们在 .apk 构建时被翻译成 Dalvik 格式。

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.

有一个 Android 库系统允许使用共享资源,例如布局和本地化字符串。由于与常规 Java 库相比,它具有更多限制,因此我仅在您确实需要共享资源时才推荐此方法。

http://developer.android.com/guide/developing/projects/projects-eclipse.html

http://developer.android.com/guide/developing/projects/projects-eclipse.html

回答by Aleadam

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.

我想你的意思是 android API(或 SDK,我不能说)和 java API(或 SDK)。基本上,android是基于java的。它是它的一个子集,但还添加了特定的类和方法来与硬件和 android 操作系统交互,实现 UI 等。

You can find info about the android architecture here: http://developer.android.com/guide/basics/what-is-android.html

您可以在此处找到有关 android 架构的信息: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...

关于优点/缺点,好吧,如果您正在为 android 操作系统开发,那么使用 android API 是一个很大的优势。如果您正在为 PC 开发,那么将不支持部分 android API,这就是我所说的缺点...

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?

总之,您需要根据您要编码的内容来选择是否使用andoid API:操作系统是否支持该API?有 JVM 吗?

回答by Steven Feldman

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.

知道支持在两者之间共享的类的序列化是非常重要的。但是它们必须位于两个项目中同名的包中。