javaandroidkotlingoogle-drive-android-api

I am trying to add files to google drive using kotlin in cororutines but getting error that main thread will be blocked even if i am using coroutine


Here is the issue I am making the file and then adding to google drive but it says inappropriate blocking method call. enter image description here


Solution

  • You should run long running task in another Thread or use Coroutine to execute blocking method.

    by using Coroutine it will be sth like this:

        withContext(Dispatchers.IO) {
            launch{
              mfile.execute();
            }
        }