Skip to content

Add check for JAVA 9 #3294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 3, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/android-tools-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
private static REQUIRED_BUILD_TOOLS_RANGE_PREFIX = ">=23";
private static VERSION_REGEX = /((\d+\.){2}\d+)/;
private static MIN_JAVA_VERSION = "1.8.0";
private static MAX_JAVA_VERSION = "1.9.0";

private showWarningsAsErrors: boolean;
private toolsInfo: IAndroidToolsInfoData;
Expand Down Expand Up @@ -111,10 +112,14 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
+ "To be able to build for Android, verify that you have installed The Java Development Kit (JDK) and configured it according to system requirements as" + EOL +
" described in " + this.$staticConfig.SYS_REQUIREMENTS_LINK;
const matchingVersion = (installedJavaVersion || "").match(AndroidToolsInfo.VERSION_REGEX);
if (matchingVersion && matchingVersion[1]) {
if (semver.lt(matchingVersion[1], AndroidToolsInfo.MIN_JAVA_VERSION)) {
const installedJavaCompilerVersion = matchingVersion && matchingVersion[1];
if (installedJavaCompilerVersion) {
if (semver.lt(installedJavaCompilerVersion, AndroidToolsInfo.MIN_JAVA_VERSION)) {
hasProblemWithJavaVersion = true;
this.printMessage(`Javac version ${installedJavaVersion} is not supported. You have to install at least ${AndroidToolsInfo.MIN_JAVA_VERSION}.`, additionalMessage);
} else if (semver.gt(installedJavaCompilerVersion, AndroidToolsInfo.MAX_JAVA_VERSION)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be gte

hasProblemWithJavaVersion = true;
this.printMessage(`Javac version ${installedJavaVersion} is not supported. You have to install version ${AndroidToolsInfo.MIN_JAVA_VERSION}.`, additionalMessage);
}
} else {
hasProblemWithJavaVersion = true;
Expand Down
2 changes: 1 addition & 1 deletion lib/common
4 changes: 2 additions & 2 deletions lib/services/doctor-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ class DoctorService implements IDoctorService {
}

const androidToolsIssues = this.$androidToolsInfo.validateInfo();
const javaVersionIssue = await this.$androidToolsInfo.validateJavacVersion(sysInfo.javacVersion);
const javaCompilerVersionIssue = await this.$androidToolsInfo.validateJavacVersion(sysInfo.javacVersion);
const pythonIssues = await this.validatePythonPackages();
const doctorResult = result || androidToolsIssues || javaVersionIssue || pythonIssues;
const doctorResult = result || androidToolsIssues || javaCompilerVersionIssue || pythonIssues;

if (!configOptions || configOptions.trackResult) {
await this.$analyticsService.track("DoctorEnvironmentSetup", doctorResult ? "incorrect" : "correct");
Expand Down