首页 文章

无法通过bazel build in tensorflow获得APK

提问于
浏览
0

1:获取推荐的Bazel版本列于:www.tensorflow.org/versions/master/get_started/os_setup.html#source我使用pip install:$ pip install tensorflow

2:安装NDK和SDK,我通过Android Studio 3安装SDK和NDK:执行以下命令:$ curl -L https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip -o /tmp/inception5h.zip $ curl -L https://storage.googleapis.com/download.tensorflow.org/models/mobile_multibox_v1.zip -o /tmp/mobile_multibox_v1.zip

$ unzip /tmp/inception5h.zip -d tensorflow / examples / android / assets / $ unzip /tmp/mobile_multibox_v1.zip -d tensorflow / examples / android / assets /

4:$ bazel build // tensorflow / examples / android:tensorflow_demo在这一步之后我得到了这个错误 .

WARNING: Bazel Android NDK crosstools are based on Android NDK revision 12. The revision of the Android NDK given in android_ndk_repository rule 'androidndk' is '13.1.3345770'.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:avgpooling_op.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:bounds_check.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops_common.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops_gradients.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_activations.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_attention.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_backward_cuboid_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_backward_spatial_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_cuboid_convolution.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_patch_3d.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_pooling.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_softmax.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_spatial_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:fifo_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:maxpooling_op.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:ops_util.cc' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:ops_util.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:padding_fifo_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:pooling_ops_common.cc' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:pooling_ops_common.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:queue_base.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:queue_op.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:typed_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_entry.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_scorer.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_search.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_decoder.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_loss_util.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:naming.cc' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:naming.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:tensor_bundle.cc' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: /Users/Rauha/tensorflow/tensorflow/core/BUILD:779:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:tensor_bundle.h' directly. You should either move the file to this package or depend on an appropriate rule there.
INFO: Found 1 target...
INFO: From Compiling external/protobuf/src/google/protobuf/util/time_util.cc [for host]:
external/protobuf/src/google/protobuf/util/time_util.cc:52:18: warning: unused variable 'kMicrosPerMillisecond' [-Wunused-const-variable]
static const int kMicrosPerMillisecond = 1000;
                 ^
external/protobuf/src/google/protobuf/util/time_util.cc:56:19: warning: unused variable 'kTimestampFormat' [-Wunused-const-variable]
static const char kTimestampFormat[] = "%E4Y-%m-%dT%H:%M:%S";
                  ^
2 warnings generated.
INFO: From Linking external/protobuf/libprotobuf_lite.a [for host]:
/Library/Developer/CommandLineTools/usr/bin/libtool: file: bazel-out/host/bin/external/protobuf/_objs/protobuf_lite/external/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.o has no symbols
/Library/Developer/CommandLineTools/usr/bin/libtool: file: bazel-out/host/bin/external/protobuf/_objs/protobuf_lite/external/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.o has no symbols
INFO: From Linking external/protobuf/libprotobuf.a [for host]:
/Library/Developer/CommandLineTools/usr/bin/libtool: file: bazel-out/host/bin/external/protobuf/_objs/protobuf/external/protobuf/src/google/protobuf/io/gzip_stream.o has no symbols
/Library/Developer/CommandLineTools/usr/bin/libtool: file: bazel-out/host/bin/external/protobuf/_objs/protobuf/external/protobuf/src/google/protobuf/util/internal/error_listener.o has no symbols
INFO: From ProtoCompile tensorflow/examples/android/proto/box_coder.pb.cc:
bazel-out/android-arm-linux-androideabi-4.9-v7a-gnu-libstdcpp-fastbuild/genfiles/external/protobuf/src: warning: directory does not exist.
INFO: From ProtoCompile tensorflow/core/example/example.pb.cc:
bazel-out/android-arm-linux-androideabi-4.9-v7a-gnu-libstdcpp-fastbuild/genfiles/external/protobuf/src: warning: directory does not exist.
INFO: From ProtoCompile tensorflow/core/example/example.pb.cc [for host]:
bazel-out/host/genfiles/external/protobuf/src: warning: directory does not exist.
INFO: From Processing Android resources for //tensorflow/examples/android:tensorflow_demo:
Jan 03, 2017 1:56:28 PM com.google.devtools.build.android.AndroidDataMerger doMerge
WARNING: 
CONFLICT: asset:WORKSPACE is provided with ambiguous priority from:
    external/mobile_multibox/WORKSPACE
    external/inception5h/WORKSPACE
CONFLICT: asset:BUILD is provided with ambiguous priority from:
    tensorflow/examples/android/assets/BUILD
    external/inception5h/BUILD
Error: Warning: AndroidManifest.xml already defines debuggable (in http://schemas.android.com/apk/res/android); using existing value in manifest.
**ERROR:** /Users/Rauha/tensorflow/tensorflow/examples/android/BUILD:58:1: Java compilation in rule '//tensorflow/examples/android:tensorflow_demo' failed: Worker process sent response with exit code: 1.
tensorflow/examples/android/src/org/tensorflow/demo/CameraActivity.java:120: error: method does not override or implement a method from a supertype
  @Override
  ^
tensorflow/examples/android/src/org/tensorflow/demo/CameraActivity.java:137: error: cannot find symbol
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                                                    ^
  symbol:   variable M
  location: class VERSION_CODES
tensorflow/examples/android/src/org/tensorflow/demo/CameraActivity.java:138: error: cannot find symbol
      return checkSelfPermission(PERMISSION_CAMERA) == PackageManager.PERMISSION_GRANTED && checkSelfPermission(PERMISSION_STORAGE) == PackageManager.PERMISSION_GRANTED;
             ^
  symbol:   method checkSelfPermission(String)
  location: class CameraActivity
tensorflow/examples/android/src/org/tensorflow/demo/CameraActivity.java:138: error: cannot find symbol
      return checkSelfPermission(PERMISSION_CAMERA) == PackageManager.PERMISSION_GRANTED && checkSelfPermission(PERMISSION_STORAGE) == PackageManager.PERMISSION_GRANTED;
                                                                                            ^
  symbol:   method checkSelfPermission(String)
  location: class CameraActivity
tensorflow/examples/android/src/org/tensorflow/demo/CameraActivity.java:145: error: cannot find symbol
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                                                    ^
  symbol:   variable M
  location: class VERSION_CODES
tensorflow/examples/android/src/org/tensorflow/demo/CameraActivity.java:146: error: cannot find symbol
      if (shouldShowRequestPermissionRationale(PERMISSION_CAMERA) || shouldShowRequestPermissionRationale(PERMISSION_STORAGE)) {
          ^
  symbol:   method shouldShowRequestPermissionRationale(String)
  location: class CameraActivity
tensorflow/examples/android/src/org/tensorflow/demo/CameraActivity.java:146: error: cannot find symbol
      if (shouldShowRequestPermissionRationale(PERMISSION_CAMERA) || shouldShowRequestPermissionRationale(PERMISSION_STORAGE)) {
                                                                     ^
  symbol:   method shouldShowRequestPermissionRationale(String)
  location: class CameraActivity
tensorflow/examples/android/src/org/tensorflow/demo/CameraActivity.java:149: error: cannot find symbol
      requestPermissions(new String[] {PERMISSION_CAMERA, PERMISSION_STORAGE}, PERMISSIONS_REQUEST);
      ^
  symbol:   method requestPermissions(String[],int)
  location: class CameraActivity
8 errors
Target //tensorflow/examples/android:tensorflow_demo failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 140.112s, Critical Path: 136.48s

1 回答

  • 0

    您在WORKSPACE文件中为SDK设置了哪些API级别?它必须> = 23或者您将获得您遇到的缺失符号错误 . AndroidManifest.xml中的目标api级别也需要> = 23 .

    请注意,该应用仍然可以在api级别> = 21的设备上运行,您只需要使用23级SDK进行构建 .

相关问题