一、修改tensorflow/workspace文件,取消android相关注释:

# Uncomment and update the paths in these entries to build the Android demo.
android_sdk_repository(name = "androidsdk",api_level = 24,# Ensure that you have the build_tools_version below installed in the # SDK manager as it updates periodically.build_tools_version = "25.0.2",# Replace with path to Android SDK on your systempath = "/home/research/Android/Sdk",
)
#
# Android NDK r12b is recommended (higher may cause issues with Bazel)
android_ndk_repository(name="androidndk",path="/home/research/Android/Sdk/ndk-bundle",# This needs to be 14 or higher to compile TensorFlow. # Note that the NDK version is not the API level.api_level=14)

二、修改 android:build.gradle 中bazel路径,默认的是如下的:

def bazelLocation = '/usr/local/bin/bazel'

但是在该路径下并没有bazel,因此会报如下错:
Error:Execution failed for task ':buildNativeBazel'.
A problem occurred starting process 'command '/usr/local/bin/bazel''
此时只需要把路径改成你的bazel路径就好,比如我的是:

def bazelLocation = '/usr/bin/bazel'

三、代码结构
基类Classifier.java,三个子类:




返回
顶部