我一直在关注this在我的应用中实现 Crashlytics
的教程。我在构建 apk 时遇到此错误,
WARNING: The major revision of the Android NDK referenced by android_ndk_repository rule 'androidndk' is 20. The major revisions supported by Bazel are [10, 11, 12, 13, 14, 15, 16, 17, 18]. Bazel will attempt to treat the NDK as if it was r18. This may cause compilation and linkage problems. Please download a supported NDK version.
ERROR: /home/sensen/GIT/UntitledFolder2/tensorflow/SenANPR/BUILD:37:1: in android_library rule //SenANPR:crashlytics_lib: The location of your BUILD file determines the Java package used for Android resource processing. A directory named "java" or "javatests" will be used as your Java source root and the path of your BUILD file relative to the Java source root will be used as the package for Android resource processing. The Java source root could not be determined for "SenANPR". Move your BUILD file under a java or javatests directory, or set the 'custom_package' attribute.
WARNING: /home/sensen/GIT/UntitledFolder2/tensorflow/tensorflow/contrib/lite/java/BUILD:43:12: in srcs attribute of android_library rule //tensorflow/contrib/lite/java:tensorflowlite: please do not import '//tensorflow/lite/delegates/nnapi/java/src/main/java/org/tensorflow/lite/nnapi:NnApiDelegate.java' directly. You should either move the file to this package or depend on an appropriate rule there
ERROR: Analysis of target '//SenANPR:senanpr' failed; build aborted: Analysis of target '//SenANPR:crashlytics_lib' failed; build aborted
INFO: Elapsed time: 0.174s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 155 targets configured)
但是我已经在我的 android_binary 中声明了 custom_package。
最佳答案
必须为不在 java
根目录下的 BUILD
文件中的所有规则设置
custom_package
,因为这些规则可以独立于任何其他规则而构建。因此,请尝试为您的 android_library
规则设置 custom_package
。
关于java - 使用 Bazel 在 Android 中实现 Crashylytics 时生成文件错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56852891/