简体   繁体   English

如何将外部依赖项添加到bazel

[英]How can you add external dependencies to bazel

I am a student and currently working on a project where I am trying to connect my game that which I have created with Android Studio. 我是一名学生,目前正在一个项目中尝试连接我使用Android Studio创建的游戏。 A neural network has also been made with Tensorflow which is going to be used for the android game. Tensorflow也已经建立了一个神经网络,它将被用于安卓游戏。

The problem is that Android Studio uses a build tool which is called Gradle and Tensorflow uses Bazel. 问题是Android Studio使用了一个名为Gradle的构建工具,而Tensorflow使用了Bazel。 To solve this problem I have been trying to build my android game with Bazel but I am stuck at the part where I have to add the used external dependencies. 为了解决这个问题,我一直试图用Bazel构建我的android游戏,但是我被困在必须添加使用的外部依赖项的部分。 For the game I use the following dependencies: 对于游戏,我使用以下依赖项:

  • Appcompat Appcompat
  • Support 支持
  • Percent 百分

Which supposedly should come with the android support repository. 据说应该随android支持库一起提供。

I have looked at http://www.bazel.io/docs/external.html and several other sources but I still do not understand how I can add the dependensies. 我看过http://www.bazel.io/docs/external.html和其他几个来源,但我仍然不明白如何添加依赖项。 Could someone provide me with an example how to do it with for example appcompat and what I have to do to make it work? 有人可以为我提供一个示例,例如如何使用appcompat以及如何使其正常工作吗? Or is there another way which would be easier? 还是有另一种方法会更容易?

EDIT: I have have been succesful in building the android example of Tensorflow but this: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/android But it doesn't include dependensies which I am using. 编辑:我已经成功地建立了Tensorflow的android示例,但这: https : //github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/android但它不包括我使用的依赖项。

You may want to look at the Makefile support we just added for Android: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/makefile 您可能想看看我们刚刚为Android添加的Makefile支持: https : //github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/makefile

It's still very experimental (and fiddly), but should let you build a static library that you can more easily use in your gradle project. 它仍然是非常实验性的(而且很有趣),但是应该让您建立一个静态库,可以更轻松地在gradle项目中使用它。

Nevermind I resolved my issues, after removing the depensies I checked the WORKSPACE file. 没关系,在删除了所有支票后,我检查了WORKSPACE文件,从而解决了问题。 It seems I didn't set the package correctly, my bad. 看来我没有正确设置软件包,不好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM