简体   繁体   English

android是否适用于JRE 7?

[英]Does android work with JRE 7?

Does Android work with JRE 7? Android是否适用于JRE 7? I can't find any documentation on it.. 我找不到任何关于它的文件..

Android does not use the JRE... it uses its own runtime optimized for mobile applications, the Dalvik VM. Android不使用JRE ......它使用自己的运行时优化的移动应用程序Dalvik VM。 however, it has most of the features of the JRE. 但是,它具有JRE的大部分功能。

Android runtime is Dalvik, but I think the question is if you can use java libraries (.jar) compiled with Java 7 (for example if you use the new try with resources clause in your source code, will it works on Android app?). Android运行时是Dalvik,但我认为问题是你是否可以使用用Java 7编译的java库(.jar)(例如,如果你在源代码中使用新的try with resources子句,它是否适用于Android应用程序?) 。

In that case I have seen that you could use with Gradles: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Using-sourceCompatibility-1.7 在那种情况下,我已经看到你可以使用Gradles: http ://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Using-sourceCompatibility-1.7

... which says: ...说:

With Android KitKat (buildToolsVersion 19) you can use the diamond operator, multi-catch, strings in switches, try with resources, etc. To do this, add the following to your build file: * 使用Android KitKat(buildToolsVersion 19),您可以在开关中使用菱形运算符,多捕获,字符串,尝试使用资源等。为此,请将以下内容添加到构建文件中: *

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 19
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

Checking the Android API I see that is not fully compliant, the ForkJoinPool in the Android API doesn't exist but the Autoclosable does it (which is used in try with resources) but from api 19. 检查Android API我发现它不完全兼容,Android API中的ForkJoinPool不存在,但Autoclosable执行它(用于尝试使用资源),但来自api 19。

Android使用Dalvik虚拟机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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