Closed aaronj1335 closed 7 years ago
UPDATE! I found the target name for the Android SDK is @bazel_tools//tools/android:sdk
, but now I'm getting:
aaronstacy∂oɹdʞooqɔɐɯ-ʎɔɐʇsuoɹɐɐ ☠ ~/Downloads/test 11:33:08 May23
§ bazel build --strategy=KotlinCompile=standalone :app
ERROR: /Users/aaronstacy/Downloads/test/BUILD:21:1: in deps attribute of kotlin_compile rule //:main: '@androidsdk//:sdk-25' does not have mandatory provider 'kt'. Since this rule was created by the macro 'kotlin_library', the error might have been caused by the macro implementation in /Users/aaronstacy/Downloads/test/BUILD:21:1.
ERROR: Analysis of target '//:app' failed; build aborted.
INFO: Elapsed time: 0.152s
OK, latest update aaronj1335/bazel-kotlin-android@ef78498 is I've figured out how to target the Android SDK, but I get a bytecode version error:
aaronstacy∂oɹdʞooqɔɐɯ-ʎɔɐʇsuoɹɐɐ ☠ ~/Downloads/test 11:57:15 May23
§ bazel build --strategy=KotlinCompile=standalone :app
............
INFO: Found 1 target...
ERROR: /Users/aaronstacy/Downloads/test/BUILD:3:1: Converting bazel-out/local-fastbuild/bin/app_deploy.jar to dex format failed: Process exited with status 1 [sandboxed].
PARSE ERROR:
unsupported class file version 52.0
...while parsing android/Manifest.class
1 error; aborting
Use --strategy=AndroidDexer=standalone to disable sandboxing for the failing actions.
Target //:app failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 23.159s, Critical Path: 7.65s
Based on bazelbuild/bazel#2222, it looks like I might be able to build from source to fix this, we'll see.
I needed neverlink = 1
for the Android SDK java_import
: aaronj1335/bazel-kotlin-android@4cc7690
Thanks for documenting it @aaronj1335, hopefully others will be able to learn from this.
Thanks for making these cool Kotlin rules for Bazel!
I was playing around with this in my aaronj1335/bazel-kotlin-android repo, but when I build, the
kotlin_library
can't find any of the Android SDK classes:If I use and
android_library
rule and a Java file instead, it works (see thejava_main
rule).Any idea how I could get this to correctly use the Android SDK to build
kotlin_library
's?Also, my targets are: