Skip to content
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

@@androidsdk//:dx_jar_import' is misplaced #21612

Open
kiritgothi opened this issue Mar 7, 2024 · 10 comments
Open

@@androidsdk//:dx_jar_import' is misplaced #21612

kiritgothi opened this issue Mar 7, 2024 · 10 comments
Labels

Comments

@kiritgothi
Copy link

kiritgothi commented Mar 7, 2024

Description of the bug:

/bazel_tools/tools/android/BUILD:248:12: in runtime_deps attribute of java_binary rule @@bazel_tools//tools/android:dexer: alias '//external:android/dx_jar_import' referring to filegroup rule '@@androidsdk//:dx_jar_import' is misplaced here (expected cc_binary, cc_library, genrule, genproto, java_import, java_library, java_proto_library, java_lite_proto_library, proto_library, sh_binary or sh_library) and '@@androidsdk//:dx_jar_import' does not have mandatory providers: 'CcInfo' or 'JavaInfo'. Since this rule was created by the macro 'java_binary', the error might have been caused by the macro implementation

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

No response

Which operating system are you running Bazel on?

Windows 11, And Ubuntu 22.0

What is the output of bazel info release?

release 7.0.2

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@iancha1992
Copy link
Member

@kiritgothi Could you please provide complete steps to reproduce this issue? Thanks

@kiritgothi
Copy link
Author

kiritgothi commented Mar 8, 2024

I am building "android-testdpc" project with "bazel build testdpc" command. Unfortunately I got error in both windows and ubuntu. This error comes from cache file of bazel which build.

ERROR: %user%/jjzqyj3b/external/bazel_tools/tools/android/BUILD:248:12: in runtime_deps attribute of java_binary rule @@bazel_tools//tools/android:dexer: alias '//external:android/dx_jar_import' referring to filegroup rule '@@androidsdk//:dx_jar_import' is misplaced here (expected cc_binary, cc_library, genrule, genproto, java_import, java_library, java_proto_library, java_lite_proto_library, proto_library, sh_binary or sh_library) and '@@androidsdk//:dx_jar_import' does not have mandatory providers: 'CcInfo' or 'JavaInfo'. Since this rule was created by the macro 'java_binary', the error might have been caused by the macro implementation
ERROR: %user%/jjzqyj3b/external/bazel_tools/tools/android/BUILD:248:12: Analysis of target '@@bazel_tools//tools/android:dexer' failed
ERROR: Analysis of target '//:testdpc' failed; build aborted: Analysis failed
INFO: Elapsed time: 15.281s, Critical Path: 0.07s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully

@ahumesky
Copy link
Contributor

Are you using the rules from github.com/bazelbuild/rules-android or the built-in ("native") android rules? Do you see the same failure if you pass --enable_bzlmod=false?

@ahumesky
Copy link
Contributor

Answering my own question, looking at https://github.com/googlesamples/android-testdpc/blob/master/BUILD, these are the native rules.

@ahumesky
Copy link
Contributor

ahumesky commented Mar 13, 2024

I wasn't able to reproduce this error, here or during debugging in #21632 with a fork of android-testdpc (at the time it had only 1 commit difference that shouldn't be relevant here) -- are there any other details you can give to help reproduce the error?

@pfmaggi
Copy link

pfmaggi commented Mar 13, 2024

I did some tests as well on two different machines (Mac OS and Debian) and I cannot reproduce this with Bazel v7.1.0.

@gottagofaster236
Copy link

I think this may be happening with bzlmod projects when the $ANDROID_HOME environment variable is not set

@rkd628
Copy link

rkd628 commented Mar 30, 2024

I faced that issue but resolved with

I think this may be happening with bzlmod projects when the $ANDROID_HOME environment variable is not set

above gottagofaster236's comment.

export ANDROID_HOME={YOUR_HOME_DIR}/Android/Sdk

@rey-aquino
Copy link

I'm experiencing the same issue for the first time while building this new Bazel build for testDPC 9.0.6.
I've tried export ANDROID_HOME={YOUR_HOME_DIR}/Android/Sdk and type env command on the terminal if the environment variable is set, but the issue still persist.

I'm using Bazel v7.1.1 and Debian OS. I will get back if ever I find a fix for this.

@rey-aquino
Copy link

I'm experiencing the same issue for the first time while building this new Bazel build for testDPC 9.0.6. I've tried export ANDROID_HOME={YOUR_HOME_DIR}/Android/Sdk and type env command on the terminal if the environment variable is set, but the issue still persist.

I'm using Bazel v7.1.1 and Debian OS. I will get back if ever I find a fix for this.

I tried this one again and it works. Make sure that you run export ANDROID_HOME={YOUR_HOME_DIR}/Android/Sdk inside android-testdpc folder, after that run bazel build testdpc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants