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 ...
随机推荐
- MySQL设置空密码
因为刚安装的时候,MySQL强制设置密码,但是我需要设置MySQL为空密码 语句: ';
- MVVM设计模式加RAC响应式编程
一:为什么要用MVVM? 为什么要用MVVM?只是因为它不会让我时常懵逼. 每次做完项目过后,都会被自己庞大的ViewController代码吓坏,不管是什么网络请求.networking data ...
- Windows 命令行解析工具(getopt)
忘记了上次在哪里找到这个功能库,只有一个 .h 和 .c 文件,再次搜索的时候发现找不到了,结果只能在之前的代码中,两个文件提出使用,顾将这两个文件备份在这里. /* Getopt for Micro ...
- 使用 JavaScript 截屏
经常在微博上看到很多内容使用的什么长微博截图,并且截图上还附加了很多其他的信息.之前对纯前端截图有些研究,正好本博客有这个需求,今天就把这东西实现了下. 需要声明的是,JavaScript 目前还不能 ...
- Python全栈之路----函数进阶----生成器
生成器特点: 不能立即产生,取一次创建一次 只能往前走 等到走到最后,就会报错 >>> a = [i for i in range(1000)] >>> a [0, ...
- A New Function(LightOJ 1098)积性函数前缀和的应用
题意:要求对于1~n,每个数的约数(不包括1和其本身)的和. 题解:由于题目数据有2*10^9之大,因而不能直接暴力.需要考虑积性函数的特性,由于必定有重复的约数出现,因而可以对重复约数所在的区间进行 ...
- Oracle数据库-sqlplus命令下出现SP2-0640: Not connected
可以正常登录sqlplus,通过sys as sysdba 但在sql>输入语句,反馈如下 解决方法: sql>输入conn sys/as sysdba Enter password: c ...
- PythonStudy——Python 注释规范
注释规范: 什么是注释? 注释:不会被python解释器解释执行,是提供给开发者阅读代码的提示 单行注释: # 开头的语句 多行注释:出现在文件最上方,用''' '''包裹的语句 Pycha ...
- H3C交换机配置vlan
一,内存二,硬盘(分区,数据量大小)三,电源线,网络线四,raid(raid0,raid1,raid5)五,装系统(系统版本,分区)六,配置网络 1.创建用户 system-view #进入配置loc ...
- linux删除某用户密码
1.清空一个linux用户密码 # passwd -d user1 passwd: password expiry information changed. 2.指定key登录 ssh port111 ...