Skip to content

Updating to 2.1.8 breaks non-android builds if ANDROID_HOME variable is set in the system but android SDK isn't configured #1352

@hb-man

Description

@hb-man

After updating to 2.1.8 I noticed a new transitive dep on rules_android in lock file.
And than I run into following error on a non-android build of hirschgarten

	File "/private/var/tmp/_bazel_Danil.Tereshchenko/a1a6972b46838be5e55c38c576f4e9d8/external/rules_android+/rules/android_sdk_repository/rule.bzl", line 114, column 13, in _android_sdk_repository_impl
		fail("No Android SDK apis found in the Android SDK at %s. Please install APIs from the Android SDK Manager." % android_sdk_path)
Error in fail: No Android SDK apis found in the Android SDK at dummy. Please install APIs from the Android SDK Manager.
ERROR: Analysis of target '//ijwb:ijwb_bazel_zip' failed; build aborted: No Android SDK apis found in the Android SDK at android_sdk_folder. Please install APIs from the Android SDK Manager.
INFO: Elapsed time: 12.611s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully

turned out, now if you build even non-android code, but you have ANDROID_HOME (possibly ANDROID_SDK_HOME as well) variable in your system withotu actual android SDK configured - it will fail, because it tries to fetch rules_android

Reproduction:

  1. git clone https://github.com/JetBrains/hirschgarten
  2. bazel build --action_env=ANDROID_HOME=dummy --action_env=ANDROID_SDK_HOME=dummy //tools/format/...
  3. bazel build --action_env=ANDROID_HOME= --action_env=ANDROID_SDK_HOME= //tools/format/...

in step 2 you'll see that it errors out, in step three it builds. Build doesn't depend on android.
same behaviour can be reproduced in https://github.com/bazelbuild/intellij - it also uses rules_kotlin

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions