jin / rules_experimental_android

Experimental Bazel Android rules and tooling integration
6 stars 3 forks source link

Path to sdk seems wrong #9

Open jinchizhou opened 4 years ago

jinchizhou commented 4 years ago

When running bazel test //:InstrumentationtestTarget, (even on Android Samples), I get error

ERROR BUILD.bazel:145:30: every rule of type composer_instrumentation_test implicitly depends upon the target '@androidsdk//:tools/bin/avdmanager', but this target could not be found because of: no such target '@androidsdk//:tools/bin/avdmanager': target 'tools/bin/avdmanager' not declared in package ''; however, a source file of this name exists.  (Perhaps add 'exports_files(["tools/bin/avdmanager"])' to /BUILD?) defined by /private/var/tmp/_bazel_jzhou4/a7fc2dbe1366eceeafbc00f93c48f32b/external/androidsdk/BUILD.bazel
ERROR: BUILD.bazel:145:30: every rule of type composer_instrumentation_test implicitly depends upon the target '@androidsdk//:tools/emulator', but this target could not be found because of: no such target '@androidsdk//:tools/emulator': target 'tools/emulator' not declared in package ''; however, a source file of this name exists.  (Perhaps add 'exports_files(["tools/emulator"])' to /BUILD?) defined by /private/var/tmp/_bazel_jzhou4/a7fc2dbe1366eceeafbc00f93c48f32b/external/androidsdk/BUILD.bazel

This may be because the path has changed since I'm on Android 3.6?

Looks like the issue is https://github.com/jin/rules_experimental_android/blob/master/composer/defs.bzl#L43 since my local $ANDROID_SDK_ROOT is correct.

Currently, I get around this by adding

alias(
    name = "emulator",
    actual = "tools/emulator",
)

alias(
    name = "avdmanager",
    actual = "tools/bin/avdmanager",
)

to /private/var/tmp/_bazel_jzhou4/a7fc2dbe1366eceeafbc00f93c48f32b/external/androidsdk/BUILD.bazel to work around the issue.

jinchizhou commented 4 years ago

@jin would you mind taking a look at this real quick? Should be very simple