I have a Kotlin app. I'm trying to pick audio from a device. Here is how I get audio file:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        if (requestCode == 111 && resultCode == Activity.RESULT_OK && data != null) {
            fileData = data.data!!
            newAudio = fileData
        }
    }
The problem is here:
val file = File(newAudio?.path!!)
val requestFile = RequestBody.create(MediaType.parse("audio/mpeg"), file)
val bodyFile = MultipartBody.Part.createFormData("file", file.name, requestFile)
RetrofitService().uploadAudio(bodyFile).enqueue(object : Callback<Any> {
    @SuppressLint("LogNotTimber")
    override fun onFailure(call: Call<Any>, t: Throwable) {
        d("#Error", "${t.message}")
        mainContent.visibility = VISIBLE
        newAudioProgressBar.visibility = GONE
        Toast.makeText(requireContext(), t.message, Toast.LENGTH_SHORT).show()
    }
    @SuppressLint("LogNotTimber")
    override fun onResponse(call: Call<Any>, response: Response<Any>) {
        navHostFragment.findNavController().navigate(R.id.myAudiosFragment)
        Toast.makeText(requireContext(), "Audio uploaded successfully!", Toast.LENGTH_SHORT).show()
    }
})
I get in logcat: D/#Error: /document/primary:Music/Track28.mp3: open failed: ENOENT (No such file or directory). The file exists because I pick it from my device. I suppose that something's wrong with this path. I'm stuck with this. Help please. Why is it?