//检查一下android sdk的版本,我的sdk/platform/android-24, so modify as the following
For tensorflow/WORKSPACE
# Uncomment and update the paths in these entries to build the Android demo.
android_sdk_repository(
name = "androidsdk",
# api_level = 23,
api_level = 24,
build_tools_version = "24.0.1",//如果配置错误,可能报错:ERROR: missing input file '@androidsdk//:platforms/android-23/android.jar'.
# Replace with path to Android SDK on your system
path = "/home/marvin/project/Sdk",
)
#
android_ndk_repository(
name="androidndk",
path="/home/marvin/project/android-ndk-r11c",
api_level=21)
export ANDROID_SDK_HOME=/home/marvin/project/Sdk
export ANDROID_NDK_HOME=/home/marvin/project/android-ndk-r11c
export PATH=${ANDROID_NDK_HOME}:${ANDROID_SDK_HOME}/platform-tools:${ANDROID_SDK_HOME}/tools:$PATH
//build命令如下:
bazel build //tensorflow/examples/android:tensorflow_demo
其他错误:
1. ubuntu卡死一次,起初怀疑是job数目为200过大导致。后来重复编译,没有再发生此类错误。因此,这里的job默认数目在ubuntu14.04上不存在问题。
2. build error cwise_op_rsqrt. d: File does not end in a newline. tensorflow
I tried several times, and the error had no long occured But I didn't any modification.
//构建成功。
INFO: Found 1 target...
Target //tensorflow/examples/android:tensorflow_demo up-to-date:
bazel-bin/tensorflow/examples/android/tensorflow_demo_deploy.jar
bazel-bin/tensorflow/examples/android/tensorflow_demo_unsigned.apk
bazel-bin/tensorflow/examples/android/tensorflow_demo.apk
INFO: Elapsed time: 56.127s, Critical Path: 31.61s
//adb install tensorflow_demo.apk. It works.