Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5688] Need support for Java 1.8 in Studio/CLI: method references are not supported in -source 1.7

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionHold
Resolution Date2018-06-19T11:20:16.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsandroid
ReporterSergey Dmitriev
AssigneeShak Hossain
Created2018-04-03T11:31:15.000+0000
Updated2019-03-20T10:26:11.000+0000

Description

I have java 1.8 installed in my build path and use 7.0.2.GA SDK. I need to build android module. I cannot build for java 1.8 - java 1.7 does not support method references.
Api2.java:33: error: method references are not supported in -source 1.7
[ERROR]                 .flatMap(ApiResponse::handleError)
Please help how to use java 1.8 with your SDK and/or toolchain. The same code built from Android Studio 3.0.1 with no problem. But the main app project is appcelerator's, I cannot use Android Studio.

Comments

  1. Joshua Quick 2018-04-03

    This was done on purpose. We currently only support Java 7 language features. We added Java 7 support as of Titanium 7.0.0. You can compile with JDK 8, but we purposely set up the Java compiler to build with Java 7, which is the -source 1.7 argument you see in the log. The reason we don't support the Java 8 language is because Google does not fully support Java 8 yet. See the link below. Some Java 8 features are supported on all Android OS versions, such as method references. But there are other Java 8 features that are only supported on Android 7.0 (aka: API Level 24) and higher... and this is the main problem that is best avoided. https://developer.android.com/studio/write/java8-support.html#supported_features Also, the impression is that Android's Java 8 support is not fully debugged yet either... https://developer.android.com/studio/write/java8-support.html#disable Java 7 has the best support on Android at the moment. Especially since it's supported on all Android OS versions. So, the plan is to stick to Java 7 until the Java 8 situation on Android improves.

JSON Source