Skip to content

Request the user upgrade if the Android SDK version is 24 - #8462

Merged
johnmccutchan merged 4 commits into
flutter:masterfrom
johnmccutchan:bar_android_sdk_24
Mar 7, 2017
Merged

johnmccutchan merged 4 commits into
flutter:masterfrom
johnmccutchan:bar_android_sdk_24

Conversation

@johnmccutchan

Copy link
Copy Markdown
Contributor
  • Detect Android SDK version 24 and request the user upgrade.
  • Consolidate on one definition of the Version class.

Fixes #7588

@johnmccutchan

Copy link
Copy Markdown
Contributor Author

@devoncarew @jakobr-google

@mit-mit mit-mit Feb 28, 2017 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this be <= 24?

@mit-mit mit-mit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks John, one questions about the version check.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Android SDK?

@devoncarew

Copy link
Copy Markdown
Contributor

lgtm w/ the version check change

@johnmccutchan

Copy link
Copy Markdown
Contributor Author

I've updated the message and the test to be < minimumAndroidSdkVersion. PTAL.

String get apksignerPath => getBuildToolsPath('apksigner');

List<String> validateSdkWellFormed({bool requireApkSigner = true}) {
if (buildToolsVersion.major < minimumAndroidSdkVersion) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is entirely right. The Android SDK and Android SDK Build-Tools are separate installs, are versioned independently, and can be used in different versions:
https://developer.android.com/studio/command-line/index.html

So AFAIK would be better if we had two different min variables, minimumAndroidSdkVersion and minimumAndroidBuildToolsVersion. Initially these can both be set to 25.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If you read the code in android_sdk.dart you'll see that we only select build tools versions that match the major version number of the platform tools. I'm happy to do the version check against both versions but flutter_tools requires platform version and build tools major version match

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Makes sense for build and platform tools to be in sync. But there are AFAIK actually four artefacts in total: SDK Platform, SDK Build Tools, SDK Platform-tools, and SDK Tools:
https://developer.android.com/studio/intro/update.html#sdk-manager

Must they all four be in sync?

I thought not -- for example, prior to https://github.com/flutter/flutter/pull/8461/files our samples were using SDK 25 but build tools 24.

Or am I totally misunderstanding this?

@johnmccutchan johnmccutchan Mar 1, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right that there are four artifacts of the Android SDK but I don't think it matters for this CL. Here is a breakdown of how things work today, what this CL does, and what we might want to do in the future:

Today:
Flutter looks at the platform and build tools versions and selects a version of build tools that has the same major version of the platform. The result of this is that flutter guarantees platformVersion.major == buildToolsVersion.major.

Flutter does not look at platform tools or SDK tools today. Maybe it should, I don't know.

This CL:
Detects if the platform/build tool major versions (they are always the same for Flutter right now) are >= 25.

Future:
In the future we may want to validate version numbers of each of these artifacts individually and may eventually need to build a blacklist / whitelist around version combinations.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This describes how the legacy build works. We're switching to Gradle-based builds, where flutter tools don't get to select the SDK or build tools versions. Instead, Gradle uses the versions specified in the build.gradle file, so it doesn't really matter what version flutter thinks it has 'selected'.

Gradle will also automatically download the versions of build tools and SDK it needs, so there's no point in checking that they're installed before we call Gradle.

We currently still support the legacy builds, where this check (and the SDK/build tools selection) matters, but once we remove that and switch completely to Gradle (#8455), all we need to check is that the SDK/build tools licenses have been accepted (#8093).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK, sounds like we have some later cleanup to do. Logged #8525 for that.

@mit-mit

mit-mit commented Mar 2, 2017

Copy link
Copy Markdown
Member

Marking this approved now that we have a cleanup bug filed.

@eseidelGoogle

Copy link
Copy Markdown
Contributor

This fixes #7588 which is the only remaining software bug open for our march 8th milestone. :) If this is needed for March 8th we ideally want to get this in this morning, since @cbracken plans to make our first branch for that release this afternoon.

@cbracken

cbracken commented Mar 6, 2017

Copy link
Copy Markdown
Member

Does this still need to make it into the hackathon branch?

@eseidelGoogle

eseidelGoogle commented Mar 6, 2017 •

Copy link
Copy Markdown
Contributor

A this point I think we can just add this to the list of issues to watch out for. And not bother merging it into the branch.

@johnmccutchan
johnmccutchan merged commit 24eeddc into flutter:master Mar 7, 2017
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android SDK 24 can lead to crashes with devices and Macs, but flutter tool says 24 is OK

7 participants