BUILD file error while implementing Crashylytics in Android using Bazel

Viewed 190

I have been following this tutorial to implement Crashlytics in my app. I am getting this error while building the 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)

But I have already declared custom_package in my android_binary.

2 Answers

custom_package has to be set for all rules that are in a BUILD file that isn't under a java root, since those rules might be built independently of any other rule. So try setting custom_package for your android_library rule too.

just the path to your work should have a folder named java!

If you look at the official examples, they have java folder then the rest of the folders that make up the package name.

https://github.com/google/mediapipe/tree/master/mediapipe/examples/android/src/java/com/google/mediapipe/apps

for me I've this

mediapipe/myAndroidApps/java/net/rmasoft/appName1

Where the package name is net.rmasoft.appname1

Related