TensorFlow Android Camera Demo 使用android studio编译安装和解决Execution failed for task ':buildNativeBazel'报错
可以参考官网:https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/android#android-studio
官网讲的很简单:
Android Studio may be used to build the demo in conjunction with Bazel. First, make sure that you can build with Bazel following the above directions. Then, look at build.gradle and make sure that the path to Bazel matches that of your system.
At this point you can add the tensorflow/examples/android directory as a new Android Studio project. Click through installing all the Gradle extensions it requests, and you should be able to have Android Studio build the demo like any other application (it will call out to Bazel to build the native code with the NDK).
简单地讲:就是
1、安装bazel
2、下载tensorflow官网代码,在tensorflow/examples/android下的build.gradle中修改bazel的路径
3、用android studio 打开tensorflow/examples/android
4、gradle会根据配置说缺少什么什么版本的api,就直接anzhuang(安装)
5、run
然后报错:
* What went wrong:
Execution failed for task ':buildNativeBazel'.
> Process 'command '/usr/bin/bazel'' finished with non-zero exit value 1
其实,这就是buildNativeBazel,用ctrl+shift+f,输入buildNativeBazel,有兩個結果:
def nativeBuildRule = 'buildNativeBazel'
task buildNativeBazel(type: Exec) {
workingDir '../../..'
commandLine bazelLocation, 'build', '-c', 'opt', \
'tensorflow/examples/android:tensorflow_native_libs', \
'--crosstool_top=//external:android/crosstool', \
'--cpu=' + cpuType, \
'--host_crosstool_top=@bazel_tools//tools/cpp:toolchain'
}
第一条结果就是一个定义,没什么用。主要是第二条,发现执行这个命令,bazel build ....执行的目录是在tensorflow下,所以想到
官网上的Building the Demo with TensorFlow from Source
需要配置
Edit WORKSPACE
NOTE: As long as you have the SDK and NDK installed, the ./configure
script will create these rules for you. Answer "Yes" when the script asks to automatically configure the ./WORKSPACE
.
The Android entries in <workspace_root>/WORKSPACE
must be uncommented with the paths filled in appropriately depending on where you installed the NDK and SDK. Otherwise an error such as: "The external label '//external:android/sdk' is not bound to anything" will be reported.
Also edit the API levels for the SDK in WORKSPACE to the highest level you have installed in your SDK. This must be >= 23 (this is completely independent of the API level of the demo, which is defined in AndroidManifest.xml). The NDK API level may remain at 14.
也就是直接打开WORKSPACE文件,将下面的填上就好了,注意andriod studio 最新的是安装ndk16,现在bazel还不支持,所以自己下载r14b,解压,然后路径填写自己解压的就可以,而sdk version 也就是api level,填写和在tensorflow/examples/android下的build.gradle中使用的版本一致就可以,因为android studio 的gradle会自动下载相应的版本,就是“4、gradle会根据配置说缺少什么什么版本的api,就直接anzhuang(安装)”
#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 = "25.0.2",
# # Replace with path to Android SDK on your system
# path = "<PATH_TO_SDK>",
#)
#
# Android NDK r12b is recommended (higher may cause issues with Bazel)
#android_ndk_repository(
# name="androidndk",
# path="<PATH_TO_NDK>",
# # This needs to be 14 or higher to compile TensorFlow.
# # Note that the NDK version is not the API level.
# api_level=14)
取消#注释,然后填入,再run就ok啦。
参考:
http://blog.csdn.net/masa_fish/article/details/54585537
http://blog.csdn.net/masa_fish
TensorFlow Android Camera Demo 使用android studio编译安装和解决Execution failed for task ':buildNativeBazel'报错的更多相关文章
- 【Android Studio使用教程6】Execution failed for task ':×××:compileReleaseAidl'
使用Android Studio运行项目时候,经常会报一些错,比如 Execution failed for task ':×××:processReleaseResources' Execution ...
- 【Android】AndroidStudio打包apk出现的一些问题 `Error:Execution failed for task ':app:lintVitalRelease'.
作者:程序员小冰,CSDN博客:http://blog.csdn.net/qq_21376985, QQ986945193 公众号:程序员小冰 1,错误代码: `Error:Execution fai ...
- Android 解决Execution failed for task ':app:clean.'报错
说实话,我还真是没见过比Execution failed for task ':app:clean.'更为恶心,更为不要脸的bug啦,代码没啥问题,一下子行让你爽爽,一下子又不鸟你啦,研究了下,终于找 ...
- 解决添加codova plugin 编译出现问题:Execution failed for task ':processDebugManifest'.
问题背景: ionic3项目上,添加cordova-plugin-cszbar,编译运行在android平台上 ,结果编译不成功.出现以下问题. Element uses-feature#androi ...
- Android Studio2.1 Run APP:Error: Execution failed for task
Android Studio2.1 Run APP时,遇到错误 Error: Execution failed for task ':app:clean'. Unable to delete file ...
- Android Studio 编译错误 Error:Execution failed for task ':app:buildInfoDebugLoader'.
今天来到打开昨天的项目运行正常,然后改动了一点代码编译报错: Error:Execution failed for task ':app:buildInfoDebugLoader'. > Exc ...
- Android Studio编译开源项目(含NDK开发)常见报错
1.未设置NDK的路径 Error:Execution failed for task ':library:ndkBuild'. > A problem occurred starting pr ...
- Android Studio 中 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileDebugAidl'.的问题解答
Android Studio 中 FAILURE: Build failed with an exception. * What went wrong: Execution failed for ta ...
- android排除报很多错方法 Execution failed for task ':app:compileDebugJavaWithJavac' in Android Studio
android排除报很多错方法1.回撤对应layout的xml改动2.回撤对应java的改动3.重命名文件后导致的资源不对应 Execution failed for task ':app:compi ...
随机推荐
- 云南-第一个应用节点-ssh登录-卡顿的问题
云南电信,从管理节点ssh连接到第一个应用节点,出现延迟卡顿的问题,解决方法: systemctl restart systemd-logind.service 附: 操作系统类型: SLES ...
- ubuntu16.04下 sublime text输入中文
1.git clone https://github.com/lyfeyaj/sublime-text-imfix.git 2.cd sublime-text-imfix && ./s ...
- A Statistical Model for Scientific Readability-paper
Authors: Luo SiCarnegie Mellon University, Pittsburgh, PA Jamie CallanCarnegie Mellon University, Pi ...
- 《Linux内核原理与分析》第三周作业
实验:基于kernel的简单的时间片轮转多道程序内核 1.实验要求 完成一个简单的时间片轮转多道程序内核代码 2.实验过程 进入实验楼的linux环境,打开shell,输入以下代码: cd Linux ...
- springMvc---跨服务器文件上传(实测总结)
序言: 该案例是采用springMvc实现跨服务器图片上传功能,其中用到的主要类和工具有:CommonsMultipartResolver.jquery.form.js.如果要实现多个文件上传,只需要 ...
- 用python 实现一个栈
前言 Python本身已有顺序表(List.Tupple)的实现,所以这里从栈开始. 什么是栈 想象一摞被堆起来的书,这就是栈.这堆书的特点是,最后被堆进去的书,永远在最上面.从这堆书里面取一本书出来 ...
- Linux Capability探索实验
Linux内核从2.1版本开始,就开始支持Capabilities的安全机制.Capabilities安全机制提出的目的在于实现系统特权操作的更加细粒度的访问控制,使用户能够根据实际的安全需求来控制r ...
- OpenStack上搭建Q版的公共环境准备(step1)
vmware14 centos7.5minimal版 controller1节点虚拟硬件配置: CPU:1颗2核 Memory:2G 硬盘:20G 网卡: VMnet1(仅主机模式):关闭DHCP,手 ...
- EXCEL自动撤销合并单元格并填充相应内容(转帖)
若EXCEL工作表有很多合并的单元格,要将所有合并的单元格撤销,并填充撤销合并前显示的内容,这是一项很繁琐且容易出错的工作.但可通过宏程序可轻松准确地搞定,方法如下: 一.实现该功能的Excel宏程序 ...
- 基础:位(bit)、字节(byte)、字符、编码之间的关系
1.位: 数据存储的最小单位.每个二进制数字0或者1就是1个位: 2.字节: 8个位构成一个字节:即:1 byte (字节)= 8 bit(位): 1 KB = 1024 B(字节): 1 MB = ...