失败:构建未成功完成

时间:2018-04-14 00:54:59

标签: android-studio tensorflow android-ndk bazel

我尝试使用ndk版本14.1.3816874,Android SDK平台工具版本27.0.1,Android SDK工具26.1.1,SDK Build-Tools 28 rc-1和Bazel在Android Studio 3.1.1中构建tensorflow演示0.11.1-自制

运行终端命令:bazel build thru terminal但是得到了以下错误

$ bazel build //tensorflow/examples/android:tensorflow_demo

android studio tensorflow build error thru bazel build command in terminal

我也尝试通过build.gradle运行构建 - bazel但仍然出错。

  

处理'命令'/ usr / local / bin / bazel''以非零退出值2完成

android studio tensorflow build error thru build.gradle

1 个答案:

答案 0 :(得分:0)

看起来Bazel不知道@androidndk在哪里。

请转到WORKSPACE个文件和make sure the following lines are not commented out

# Uncomment and update the paths in these entries to build the Android demo.
android_sdk_repository(
    name = "androidsdk",
    api_level = 23,
    # Ensure that you have the build_tools_version below installed in the
    # SDK manager as it updates periodically.
    build_tools_version = "26.0.1",
    # Replace with path to Android SDK on your system
    path = "<PATH_TO_SDK>",
)

android_ndk_repository(
    name="androidndk",
    path="<PATH_TO_NDK>",
    # This needs to be 14 or higher to compile TensorFlow.
    # Please specify API level to >= 21 to build for 64-bit
    # archtectures or the Android NDK will automatically select biggest
    # API level that it supports without notice.
    # Note that the NDK version is not the API level.
    api_level=14
)