I was wondering if I can use default methods in interfaces in Android development. The feature is included in Java 8, but I have found out that Android Java VM doesn't yet support it. It there any way to use default methods in Android development? If not, when this feature will be available, is there some kind of timeline for this features?
-
2`Android Java VM doesn't yet support it`. This statement itself answers your question. And it says **NO**. – Phantômaxx Oct 03 '14 at 07:27
-
@FrankN.Stein I was also trying to understand if these is some timeline for such features. I've refined the question. – Dan Tumaykin Oct 03 '14 at 09:03
-
Again, the answer seems to be **NO**. – Phantômaxx Oct 03 '14 at 09:05
2 Answers
On the availability: I think we'll see default methods in Android N. There are already a lot of tests related to default methods for the new Jack compiler on AOSP. See http://bit.ly/1PZoV1A
And today the java.util.function package has been merged into the ojluni master (including default methods and the use of lambdas).
Edit: Here is the official confirmation that Android N is going to support Java 8: http://developer.android.com/preview/j8-jack.html Streams are still missing but java.util.Spliterator(s) has been integrated yesterday. Given the current pace, I'd expect we'll see the Stream API in May.

- 3,182
- 7
- 28
- 38
Possible duplicate : will android java support lambda expression in java 8?
In the possible duplicate question, kapep answered this (read the full answer for more details) :
Android doesn't use Oracle's Java SE versions, it's based on parts of the Apache Harmony project so it doesn't even support Java 7. Harmony is not actively developed any more and won't support 1.7.
So I think you can forget new features of Oracle Java version for Android development and follow the Android API (not the Oracle one).
-
3Android supports Java 7 in API Level 19. See [here](http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Using-sourceCompatibility-1.7). – Steve Benett Oct 03 '14 at 07:55
-