this code used to work until a couple of days ago.
it still works in the debug version, but not in the release anymore.
no updates have been done to SDK or gradle.
the oauth apps are correctly set in google console, the correct SHA1 keys are entered.
now it just fails with:
Error during GoogleDriveManager.uploadFile operation:
java.lang.IllegalArgumentException: key error
suspend fun uploadFile(credential: GoogleAccountCredential, file: File): Date? {
return withContext(Dispatchers.Default) {
try {
val drive = Drive.Builder(
NetHttpTransport(),
JacksonFactory.getDefaultInstance(),
credential
)
.setApplicationName(string(R.string.app_name))
.build()
val googleDriveFile = GoogleDriveFile()
googleDriveFile.name = file.name
val fileContent = FileContent("text/txt", file)
drive.Files().create(googleDriveFile, fileContent).execute()
Date()
} catch (exception: Exception) {
log {
"Error during GoogleDriveManager.uploadFile operation: ${exception}"
}
null
}
}
}