Skip to content

platforms/android-23/core-for-system-modules.jar missing #413

@tholenst

Description

@tholenst

I'm trying to build my library for Android using Bazel, and depending on the way I install the SDK things fail.

For this issue, we using bzlmod.

To reproduce, I first install the SDK in /tmp/core-for-system-modules-repro/

rm -rf /tmp/core-for-system-modules-repro
mkdir /tmp/core-for-system-modules-repro
cd /tmp/core-for-system-modules-repro
mkdir sdk_with_23/
mkdir sdk_with_30/
mkdir sdk_with_23_and_30

wget https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip
unzip commandlinetools-linux-8512546_latest.zip

yes | cmdline-tools/bin/sdkmanager --sdk_root=/tmp/core-for-system-modules-repro/sdk_with_23/           "build-tools;30.0.3" "platform-tools" "platforms;android-23"
yes | cmdline-tools/bin/sdkmanager --sdk_root=/tmp/core-for-system-modules-repro/sdk_with_23_and_30/    "build-tools;30.0.3" "platform-tools" "platforms;android-23" "platforms;android-30"
yes | cmdline-tools/bin/sdkmanager --sdk_root=/tmp/core-for-system-modules-repro/sdk_with_30/           "build-tools;30.0.3" "platform-tools" "platforms;android-30"

We then create MODULE.bazel and .bazelversion:

cat > MODULE.bazel <<EOF
bazel_dep(name = "rules_java", version = "7.11.1")
bazel_dep(name = "bazel_skylib", version = "1.3.0")

bazel_dep(name = "rules_android", version = "0.6.6")

remote_android_extensions = use_extension(
    "@rules_android//bzlmod_extensions:android_extensions.bzl",
    "remote_android_tools_extensions")
use_repo(remote_android_extensions, "android_tools")

android_sdk_repository_extension = use_extension("@rules_android//rules/android_sdk_repository:rule.bzl", "android_sdk_repository_extension")
use_repo(android_sdk_repository_extension, "androidsdk")
android_sdk_repository_extension.configure(build_tools_version = "30.0.3", api_level = 30, path="/tmp/core-for-system-modules-repro/sdk")

register_toolchains("@androidsdk//:sdk-toolchain", "@androidsdk//:all")
EOF


cat > .bazelversion <<EOF
8.4.1
EOF

Building with sdk_with_30 works:

cp -r sdk_with_30 sdk
bazel clean; bazel build @rules_android//:androidsdk_files

(INFO: Build completed successfully, 1 total action)

However, building with sdk_with_23_and_30 doesn't work:

rm -rf sdk; cp -r sdk_with_23_and_30 sdk
bazel clean; bazel build @rules_android//:androidsdk_files

ERROR: /home/tholenst/.cache/bazel/_bazel_tholenst/8459a255b91a183168e554695f792479/external/rules_android++android_sdk_repository_extension+androidsdk/BUILD.bazel:57:25: @@rules_android+//:androidsdk_files: missing input file '@@rules_android++android_sdk_repository_extension+androidsdk//:platforms/android-23/core-for-system-modules.jar'

This is a bit weird to me since I'm even selecting for api_level 30. It might be that I'm misunderstanding something, however.

I'd also like to build my library with api_level 23 only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions