Android的SDK支持编码的Java的哪些版本的哪个版本?版本、Android、SDK、Java

2023-09-07 04:13:26 作者:一曲琵琶倾城梦

我在写为Android SDK 2.3.3 Android应用程序,但后来我被要求运行Android 2.2.1的设备上进行测试。所以,我把我的目标为8,而不是10,但随后java.util.concurrent.TimeUnit中只用了Java 1.5的功能集,而不是java.util.concurrent.TimeUnit中的Java的1.6 / 1.7的功能集。所以我把在OpenJDK 6实现的TimeUnit到我的包,我的Andr​​oid应用程序,一切工作正常。

I was writing an Android app for Android SDK 2.3.3 but then I was asked to test it on a device running Android 2.2.1. So I set my target to 8 instead of 10. But then java.util.concurrent.TimeUnit only had the Java 1.5 feature set instead of the Java 1.6/1.7 feature set of java.util.concurrent.TimeUnit. So I put the openjdk 6 implementation of TimeUnit into my package for my Android app and everything works fine.

有谁知道在哪里可以得到一些文档,这给了我一个图表,告诉我,例如,使用官方的SDK的时候,Android 2.2的必须是使用Java 1.5的关键字/语法/ API的,Android的codeD 2.3.3可以使用Java 1.6关键字codeD /语法/原料药等...?

Does anyone know where I can get some documentation that gives me a chart that tells me, for example, that when using the official SDK, Android 2.2 has to be coded using Java 1.5 keywords/syntax/APIs, Android 2.3.3 can be coded using Java 1.6 keywords/syntax/APIs, etc...?

推荐答案

您正在尝试一下Android作为Java的一个子集,它不是。它们是完全分开的。尽管Android自带从Java,它从它离开颇有几分不存在相关性的版本明智了两者之间。

You are trying to look at Android as a subset of Java which it is not. They are completely separated. Even though Android comes from Java, it as departed from it quite a bit and there is no correlation 'version-wise' anymore between the two.

什么,你可以看看是Android文档。对于每一个指令/命令/方法/属性,在右上角,你会发现在API层面上,你能获得上述财产。

What you can look at is the Android documentation. For every instruction/command/method/properties, at the top right you'll find the api level at which you are able to access said property.

点击API级别将带你到一个网页,其中包含的转换API级别到Android版本的表。

Clicking on the api level will take you to a page which contains a table that translates api level to Android versions.

最简单的办法,找出如果你被允许使用一个属性是使用Eclipse和做什么,你只是没:更改目标API级别。然后是不提供给您的任何调用方法或属性会产生致命错误。

The easy way to find out if you are allowed to use a property is using eclipse and doing what you just did : Change the target api level. Then any call to methods or properties that are not available to you will produce fatal errors.

 
精彩推荐
图片推荐