It's time to try java 8 features on Android with official support!
This project includes two sample hello world apps to play with java8 features out of the box.
So the only steps you need to follow are:
- Install Java8 on your machine. Check if you already have it at /Library/Java/JavaVirtualMachines for OS X.
- Download Android Studio Preview 2.1 (introduces the new jack compiler and toolchain)
- Point to Java 8 in Project structure (
โ
+;
) - Download this project and run it.
This project includes two apps:
- lambda-app: Let's you try lambdas compatible with any device/emulator API 10+
-
more-java8-app: Let's you try the rest of the Java 8 features supported only by Android N
Only compatible with devices/emulators API 24+ (N)
Just in case you can't find the new Android N emulator:
- Open AVD Manager.
- Press the Create new virtual device button
- Select any definition you like and press next
- Here comes the trick. Notice the x86 tab selected. By default the Recommended tab is selected and probably you won't find the N emulator there.