flickrApi.fetchUrlBytes(url) return 503, how to fix it?

When I finished chapter 26, I found that I couldn’t download pictures anymore. Because of the following deubg:

/com.bignerdranch.android.photogallery I/FlickrFetchr: Decoded bitmap=null from Response=Response{protocol=h2, code=503, message=, url=https://live.staticflickr.com/65535/52132766548_abe71dd65a_m.jpg?api_key=******&format=json&nojsoncallback=1&extras=url_s&safesearch=1}

I tried commenting out .client(client) and restoring the annotation of fun fetchPhotos(): Call<FlickrResponse>’ and it worked.

my environment:

implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'

Complie:

  1. compileSdk 32
  2. minSdk 21
  3. targetSdk 32

Run: Android 11

1 Like