Log statement unable to print

I’m fairly new to Kotlin, coming from Java. But to give some background information, I’m building an object detection application (in Kotlin , for Android). The application uses CameraX to build a camera preview and Google ML to provide machine learning expertise. Just for reference; I used this CameraX documentation and this this Google ML Kit documentation.

My issue today revolves around Step 4 of the Google ML documentation, which provides steps for both Kotlin and Java users. I’m currently attempting to print Log.d("TAG", "onSuccess" + it.size) to my Android Studio console in order to determine if .addonSuccessListener is actually running. If it does, it should print something along the lines of onSuccess1 . However, I’m not even entirely sure the following code is even running. Would anybody happen to know why?

objectDetector
                    .process(image)
                    .addOnSuccessListener {
                        Log.d("TAG", "onSuccess" + it.size) //I want this to print
                        for (detectedObject in it)
                        {
                            val boundingBox = detectedObject.boundingBox
                            val trackingId = detectedObject.trackingId
                            for (label in detectedObject.labels) {
                                val text = label.text
                                val index = label.index
                                val confidence = label.confidence
                            }
                        }
                    }

If more code from this class is required to resolve this problem, I’ve formatted it all into this Pastebin link. Any further information required to resolve this problem will be provided upon request.

I’m not an Android developer, so maybe I’m wrong, but I believe debug log level is disabled by default on most/some devices. Enable it (search google) or just use Log.i() instead.

Consider checking addOnFailureListener too. Maybe it even has a progress listener? (didn’t look too deeply at the docs)

FYI: “How do I use such and such JVM library” is not really a Kotlin question and you’ll likely have better luck on another forum.

Unfortunately, this isn’t the case. While this is my first time with Kotlin, I’m experienced enough with Java to know that debug log level isn’t disabled by default; at least on my device.

And even using Log.i() isn’t printing.

To answer your first post, .addOnFailureListener isn’t printing either. This is what really confuses me, and has prompted me to come here to ask this question. The code also has an .addOnCompleteListener, if that helps.

For your second question, this particular JVM library tends to have smaller pockets of communities and forums that are present in the form of sub-Reddits and StackOverFlow tags. I had merely redirected my question here in hopes that there may be any help.