I am attempting to move an Android project from Gradle to Bazel, but I am encountering an error when I try to build through Android Studio.
Building the project through the command line (i.e bazel build //...), everything compiles successfully and I can run the app on an emulator. However, building the project in Android Studio using the bazel plugin results in the following error:
ERROR: Encountered error while reading extension file 'intellij_info_bundled.bzl': no such package '@intellij_aspect//': /private/var/tmp/_bazel_tommy/8d411f88fac27b5686c7986040e7ebb8/external/intellij_aspect must be an existing directory.
I am using Android Studio 3.2 and Bazel plugin version 2018.11.12.0.4. I have attempted a bazel clean, reinstallation of Android Studio, and several different Bazel plugin versions. Please let me know if you need me to add any more information regarding this issue.
Which version of bazel are you using? Could you include the full bazel command printed in the 'Bazel Console' view when you try to sync?
My guess is that this is a problem with importing the plugin. I had the same error and fixed it by first removing the bazel cache:
rm -rf ~/.cache/bazel/_bazel_$USERNAME/
And then manually importing the plugin into Android Studio
mv aswb ~/.AndroidStudio3.3/config/plugins/
After a restart it detects the plugin properly.
Also make sure you have the correct plugin version for your Android Studio.
If you're on macOS, the following helps:
~/Library/Application Support/IntelliJIdea<version> to a directory without spaces.idea.properties file, set idea.plugins.path to that directory.For more on how to modify that property, check here https://intellij-support.jetbrains.com/hc/en-us/articles/207240985
Most helpful comment
If you're on macOS, the following helps:
~/Library/Application Support/IntelliJIdea<version>to a directory without spaces.idea.propertiesfile, setidea.plugins.pathto that directory.For more on how to modify that property, check here https://intellij-support.jetbrains.com/hc/en-us/articles/207240985