Bazel: Android studio cannot find all aar librarys!

Created on 29 Jun 2017  路  6Comments  路  Source: bazelbuild/bazel

When i use Android studio open my project, all jars can be found but the aars ?
For example:

android_binary(
   ...
   deps = [
      "a",
      "b",
   ]
   ...
)
java_import(
    name = "a",
    jars = [
       "libs/a.jar",
    ]
)

aar_import(
   name = "b",
   aar = "libs/b.aar",
)

The a.jar can be found but the b.aar!
bazel build //my:app run well, However, It can not found by android studio!


The generated project has files: .bazel/modules/.project-data-dir.iml!
All deps third jar is in it like this:

...
<orderEntry type="library" name="gson-2.7-ijar_243ebdc5" level="project" />
...

But no reference to aar.

My Android studio version is 2.2.2 !
How should I do to set it?

P2 bug

All 6 comments

This is a known bug in aar_import right now. It was implemented without proper IDE support. The first step to fix that was in a7be6f6df4d3cc5f0f8107b8ffc15f0496e001c6, but it will also require a change to the Android Studio IDE plugin in https://github.com/bazelbuild/intellij.

This was reported to the android studio plugin plugin in https://github.com/bazelbuild/intellij/issues/103.

Thanks! I see! How long will this change take?

@aj-michael This bug remain unsolved ! Do you have some hack solutions?

aar_import should be handled now in the plugin (I tried plugin version 2018.03.12.0.6 on the example in https://github.com/bazelbuild/intellij/issues/103)

See https://github.com/bazelbuild/intellij/blob/983a509e55b78aaa5323adc9e2742db783d90d57/aswb/src/com/google/idea/blaze/android/sync/model/AarLibrary.java, and related code

Thanks Jan!

Was this page helpful?
0 / 5 - 0 ratings