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

Open
#413 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 6 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
android, java
Domain
build-system

Research direction

Reproduce with the supplied SDK layouts and MODULE.bazel configuration, starting with bazel build @rules_android//:androidsdk_files. Inspect the android_sdk_repository_extension setup and the generated androidsdk target, especially the referenced platforms/android-23/core-for-system-modules.jar. Done means the target builds with SDKs containing API 23 alone, API 30 alone, and both platforms.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Java
Stars
205
Forks
113
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bazelbuild/rules_android

All issues in bazelbuild/rules_android

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.