Android RecyclerView Tutorial with Kotlin | raywenderlich.com

Hi, I have completed the tutorial until the recycler view is ready to show the data, but mine is not showing anything when running the app. I tried running the galacticon-final app and it is not showing anything too. Is anyone having the same problem?

I apologize that I had to paste the logcat here because I am a new user and unable to upload document.

2020-09-05 12:29:21.521 12407-12407/? I/lich.galactico: Not late-enabling -Xcheck:jni (already on)
2020-09-05 12:29:21.600 12407-12407/? E/lich.galactico: Unknown bits set in runtime_flags: 0x8000
2020-09-05 12:29:21.603 12407-12407/? W/lich.galactico: Unexpected CPU variant for X86 using defaults: x86
2020-09-05 12:29:22.538 12407-12407/com.raywenderlich.galacticon W/RenderThread: type=1400 audit(0.0:656): avc: denied { write } for name=“property_service” dev=“tmpfs” ino=7137 scontext=u:r:untrusted_app_27:s0:c149,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0 app=com.raywenderlich.galacticon
2020-09-05 12:29:22.556 12407-12447/com.raywenderlich.galacticon D/libEGL: Emulator has host GPU support, qemu.gles is set to 1.
2020-09-05 12:29:22.557 12407-12447/com.raywenderlich.galacticon W/libc: Unable to set property “qemu.gles” to “1”: connection failed; errno=13 (Permission denied)
2020-09-05 12:29:22.599 12407-12447/com.raywenderlich.galacticon D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
2020-09-05 12:29:22.609 12407-12447/com.raywenderlich.galacticon D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
2020-09-05 12:29:22.618 12407-12447/com.raywenderlich.galacticon D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
2020-09-05 12:29:22.873 12407-12407/com.raywenderlich.galacticon W/lich.galactico: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2020-09-05 12:29:22.875 12407-12407/com.raywenderlich.galacticon W/lich.galactico: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2020-09-05 12:29:23.102 12407-12407/com.raywenderlich.galacticon D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2020-09-05 12:29:23.113 12407-12407/com.raywenderlich.galacticon W/lich.galactico: Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (greylist,core-platform-api, reflection, allowed)
2020-09-05 12:29:23.113 12407-12407/com.raywenderlich.galacticon W/lich.galactico: Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (greylist,core-platform-api, reflection, allowed)
2020-09-05 12:29:23.113 12407-12407/com.raywenderlich.galacticon W/lich.galactico: Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (greylist,core-platform-api, reflection, allowed)
2020-09-05 12:29:23.294 12407-12445/com.raywenderlich.galacticon D/HostConnection: HostConnection::get() New Host Connection established 0xe034d2d0, tid 12445
2020-09-05 12:29:23.299 12407-12445/com.raywenderlich.galacticon D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2
2020-09-05 12:29:23.302 12407-12445/com.raywenderlich.galacticon W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without

2020-09-05 12:29:23.310 12407-12445/com.raywenderlich.galacticon D/EGL_emulation: eglCreateContext: 0xe031a3c0: maj 2 min 0 rcv 2
2020-09-05 12:29:23.335 12407-12445/com.raywenderlich.galacticon D/EGL_emulation: eglMakeCurrent: 0xe031a3c0: ver 2 0 (tinfo 0xe030f0b0)
2020-09-05 12:29:23.380 12407-12445/com.raywenderlich.galacticon W/Gralloc3: mapper 3.x is not supported
2020-09-05 12:29:23.384 12407-12445/com.raywenderlich.galacticon D/HostConnection: createUnique: call
2020-09-05 12:29:23.384 12407-12445/com.raywenderlich.galacticon D/HostConnection: HostConnection::get() New Host Connection established 0xe034d460, tid 12445
2020-09-05 12:29:23.388 12407-12445/com.raywenderlich.galacticon D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2
2020-09-05 12:29:23.389 12407-12445/com.raywenderlich.galacticon D/eglCodecCommon: allocate: Ask for block of size 0x1000
2020-09-05 12:29:23.389 12407-12445/com.raywenderlich.galacticon D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3fefae000 size 0x2000
2020-09-05 12:29:23.417 12407-12445/com.raywenderlich.galacticon D/EGL_emulation: eglMakeCurrent: 0xe031a3c0: ver 2 0 (tinfo 0xe030f0b0)
2020-09-05 12:29:23.958 12407-12445/com.raywenderlich.galacticon I/OpenGLRenderer: Davey! duration=733ms; Flags=0, IntendedVsync=303554536645056, Vsync=303555019978370, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=303555029268900, AnimationStart=303555029360000, PerformTraversalsStart=303555029508100, DrawStart=303555033549400, SyncQueued=303555035879800, SyncStart=303555036898900, IssueDrawCommandsStart=303555037031600, SwapBuffers=303555044891500, FrameCompleted=303555270755500, DequeueBufferDuration=487000, QueueBufferDuration=2496000,
2020-09-05 12:29:24.423 12407-12448/com.raywenderlich.galacticon W/lich.galactico: Accessing hidden method Lcom/android/org/conscrypt/ConscryptFileDescriptorSocket;->setUseSessionTickets(Z)V (greylist,core-platform-api, reflection, allowed)
2020-09-05 12:29:24.423 12407-12448/com.raywenderlich.galacticon W/lich.galactico: Accessing hidden method Lcom/android/org/conscrypt/ConscryptFileDescriptorSocket;->setHostname(Ljava/lang/String;)V (greylist,core-platform-api, reflection, allowed)
2020-09-05 12:29:24.423 12407-12448/com.raywenderlich.galacticon W/lich.galactico: Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setAlpnProtocols([B)V (greylist,core-platform-api, reflection, allowed)
2020-09-05 12:29:24.778 12407-12448/com.raywenderlich.galacticon W/lich.galactico: Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->getAlpnSelectedProtocol()[B (greylist,core-platform-api, reflection, allowed)
2020-09-05 12:29:25.079 12407-12448/com.raywenderlich.galacticon W/System.err: org.json.JSONException: No value for media_type
2020-09-05 12:29:25.080 12407-12448/com.raywenderlich.galacticon W/System.err: at org.json.JSONObject.get(JSONObject.java:399)
2020-09-05 12:29:25.080 12407-12448/com.raywenderlich.galacticon W/System.err: at org.json.JSONObject.getString(JSONObject.java:560)
2020-09-05 12:29:25.080 12407-12448/com.raywenderlich.galacticon W/System.err: at com.raywenderlich.galacticon.ImageRequester$getPhoto$1.onResponse(ImageRequester.kt:83)
2020-09-05 12:29:25.081 12407-12448/com.raywenderlich.galacticon W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
2020-09-05 12:29:25.081 12407-12448/com.raywenderlich.galacticon W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
2020-09-05 12:29:25.081 12407-12448/com.raywenderlich.galacticon W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2020-09-05 12:29:25.082 12407-12448/com.raywenderlich.galacticon W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2020-09-05 12:29:25.083 12407-12448/com.raywenderlich.galacticon W/System.err: at java.lang.Thread.run(Thread.java:919)

Looking at the log, I see 2 things:
com.raywenderlich.galacticon.ImageRequester$getPhoto$1.onResponse(ImageRequester.kt:83)
This means that you were attempting to get a photo. Then:
org.json.JSONException: No value for media_type
There was a JSON exception when trying to get the string.
This line looks like it might be the problem:
if (!photoJSON.getString(MEDIA_TYPE_KEY).equals(MEDIA_TYPE_VIDEO_VALUE))

It’s possible that the JSON string doesn’t have a media type. You could try and change it to:
if (!photoJSON.has(MEDIA_TYPE_KEY) || !photoJSON.getString(MEDIA_TYPE_KEY).equals(MEDIA_TYPE_VIDEO_VALUE)) {

Looks like ‘:’ (colon) missing in ‘class RecyclerAdapter(private val photos: ArrayList) RecyclerView.Adapter<RecyclerAdapter.PhotoHolder>() {’

" Start a new activity by replacing the log in ViewHolder’s onClick with this code:"
Suggest “ViewHolder’s” should be PhotoHolder’s

Good eye. I’ve updated the tutorial

Thanks, Kevin, good to see these tutorials are ‘live,’ with someone looking at the comments.

Great tutorial 
 really helps to have a discussion/description of what’s going on! Had some problems at one point (wasn’t changing ‘focus’) and was able to troubleshoot and find the two lines of code I left out.

Expect to subscribe if/when I find a paying gig working in this area.
Jim