google-developer-training / basic-android-kotlin-compose-training-workmanager

Apache License 2.0
30 stars 31 forks source link

Background Work with WorkManager: Issue in conditional block #17

Closed parmeshtoyou closed 11 months ago

parmeshtoyou commented 11 months ago

URL of codelab https://developer.android.com/codelabs/basic-android-kotlin-compose-workmanager?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-7-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-workmanager#9 Specify the language of the codelab if it is not English:

In which task and step of the codelab can this issue be found? Step 10

Describe the problem //this block will get execute when resource is is not empty or null but inside the block we are require(!resourceUri.isNullOrBlank()) { val errorMessage = applicationContext.resources.getString(R.string.invalid_input_uri) Log.e(TAG, errorMessage) errorMessage }

Steps to reproduce?

  1. Go to : https://developer.android.com/codelabs/basic-android-kotlin-compose-workmanager?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-7-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-workmanager#9
  2. Check below code: return@withContext try { // NEW code require(!resourceUri.isNullOrBlank()) { val errorMessage = applicationContext.resources.getString(R.string.invalid_input_uri) Log.e(TAG, errorMessage) errorMessage }
  3. Error in handling condition

Versions _Android Studio version: N/A _API version of the emulator: N/A

Additional information

Screenshot 2023-11-23 at 16 40 44

Include screenshots if they would be useful in clarifying the problem.