0

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).
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. I tried by forcing the build on 1.7 or 1.8, but nothing works.

Thank you in advance

asked Apr 23, 2015 at 19:23
2
  • This is a case in which it totally should work, and if there's an issue it's due to something you're not telling us... Commented Apr 23, 2015 at 19:25
  • Ok I just saw that my android studio is using <Android API 21 Platform>. If I go in external libraries and search for Matcher in this library, the method is not there. In other words I have this in my external libraries folder: -- External libraries -- <Android API 21 Platform> -- < 1.8 > In the < 1.8 > folder I can find the right Matcher class, but in < Android API 21 platform> not. Seems that this API is using a java version below 7. Commented Apr 23, 2015 at 19:33

1 Answer 1

4

This is not supported by Android. See the documentation of the Android version of java.util.regex.Matcher at

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. The method you want to use was introduced in Java 1.7, and has not (as of this writing) been included in Android.

Possibly that might change at some point in the future, or it might not.

answered Apr 23, 2015 at 19:38
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for the reply. I can do the same thing, but I have to use group numbers. A bit more boring, but at least is possible.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.