简体   繁体   中英

API level with JRE versions

Does JRE 1.7 work with all api levels of android? I want to make an app by this situation:

<uses-sdk
    android:minSdkVersion = "7"
    android:targetSdkVersion = "19" />

Is this ok with jre 1.7 ? or do I need to use jre 1.6 .

How can I figure this out which API level with which JRE version is compatible ?

The core Java libraries are part of the Android runtime (see image below) layer, but from developer point of view it doesn't matter . What you can do and cannot do is tied to Android SDK level you use in your project.

在此处输入图片说明

Which android:minSdkVersion you should use?

You can check 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. Clicking on the API level will take you to a page which contains a table that translates API level to Android versions.

As a general principle set android:minSdkVersion as low as possible. You will get a compiler error when you use something not supported by that level. This way you can support as many users as you can. See this for details.

Here is a recommended reading on this subject.

Android API level is specific to which version you are using(as in ICS, Kitkat etc). What JRE you use is independent thing.

But is it better you use the most recent JRE ie Java 7 irrespective of what your API level target is.

It may happen that the recent API levels may use some java functions introduced in recent java versions. So again irrespective of your target API level use Java 7.

See this SO answer for more info.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM