简体   繁体   English

Android Studio和JDK

[英]Android studio and JDK

I'm working with android studio 1.1.0 and JDK 8. Currently I'm working with regular expressions, but my android studio cannot resolve the method Matcher.group(String name), it can only access Matcher.group() and Matcher.group(int num). 我正在使用android studio 1.1.0和JDK8。目前,我正在使用正则表达式,但我的android studio无法解析Matcher.group(String name)方法,它只能访问Matcher.group()和Matcher .group(int num)。
Did anyone encounter the same problem? 有人遇到过同样的问题吗? Are there any fixies? 有任何修复方法吗?
This is really annoying because if I inspect the external libraries I can actually find the class Matcher which contains the requested method. 这真的很烦人,因为如果我检查外部库,我实际上可以找到包含请求的方法的Matcher类。 I tried by forcing the build on 1.7 or 1.8, but nothing works. 我尝试通过在1.7或1.8上强制构建,但是没有任何效果。

Thank you in advance 先感谢您

This is not supported by Android. Android不支持此功能。 See the documentation of the Android version of java.util.regex.Matcher at 请参阅位于以下位置的Android版本的 java.util.regex.Matcher的文档:

http://developer.android.com/reference/java/util/regex/Matcher.html http://developer.android.com/reference/java/util/regex/Matcher.html

The important thing to remember is that irrespective of which JDK is being used, you are not targeting Java, but rather the Android platform, so you only have the subset of Java functionality implemented there. 要记住的重要一点是,无论使用哪个JDK,您都不会针对Java,而是针对Android平台,因此您只在其中实现了Java功能的子集 The method you want to use was introduced in Java 1.7, and has not (as of this writing) been included in Android. 您要使用的方法是Java 1.7中引入的,并且(截至撰写本文时)尚未包含在Android中。

Possibly that might change at some point in the future, or it might not. 将来可能会有所改变,也可能不会改变。

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

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