android - 如何将 Android 的导航架构组件与 Bazel 一起使用?

标签 android bazel

我正在尝试更新一个旧的 Android 应用程序,以使用使用导航架构组件的现代单 Activity 模型。我如何使用 Bazel 做到这一点?

我的应用程序已经使用 Bazel 来构建,但看起来导航框架需要一个 gradle 插件: https://developer.android.com/jetpack/androidx/releases/navigation

我不太清楚如何使用 Bazel 来完成这项工作。

最佳答案

无需使用 Safe Args Gradle 插件即可使用导航(运行时本身不依赖于 Gradle 等)。根据 Pass Data documentation ,您可以使用 Bundle 来传递参数。

res/navigation 文件夹支持是 aapt2 的一部分。根据 this Bazel issue , aapt2 还不是 Bazel 的默认设置。根据 linked commit :

To build with aapt2 today, pass the flag --incompatible_use_aapt2_by_default=true or --android_aapt=aapt2, or set the aapt_version to aapt2 on your android_binary or android_local_test target.

关于android - 如何将 Android 的导航架构组件与 Bazel 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57174503/

相关文章:

android - 为 TextView 使用 XML 布局

bazel - 获取给定 bazel 目标的特定属性的值

java - 为什么 java_executable_exec_path 给我一个遗留的 "external"运行文件路径

python - 没有这样的包 'slim' : BUILD file not found - Tensorflow

python - 从源安装后,TensorFlow 无法加载运行时

android - 从 android 应用程序打开 facebook 页面(在 facebook 版本 > v11 中)

android - 是否可以使用 native Android map v2 来指示 Android map 折线中对象的方向?

Android:设置蓝牙可发现性无限制

android - Hyperion-Android : ServiceLoader can’t load custom Plugin

java - 如何在 Bazel 中依赖测试 Maven jar?