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
-
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...Anubian Noob– Anubian Noob2015年04月23日 19:25:22 +00:00Commented 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.Christopher A– Christopher A2015年04月23日 19:33:11 +00:00Commented Apr 23, 2015 at 19:33
1 Answer 1
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.