Kotaro666-dev / android-project-refactoring

Apache License 2.0
1 stars 0 forks source link

バグを修正 #3

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

本プロジェクトには、至る所にバグが潜んでいます。下記のリストを参考にバグを修正してください。

Kotaro666-dev commented 1 year ago

デバッグビルド時のログ

$ adb shell am start -n "jp.co.yumemi.android.codecheck.debug/jp.co.yumemi.android.code_check.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: jp.co.yumemi.android.codecheck.debug | jp.co.yumemi.android.codecheck.debug.test
Waiting for application to come online: jp.co.yumemi.android.codecheck.debug | jp.co.yumemi.android.codecheck.debug.test
Connected to process 22034 on device 'google-pixel_3-8CSX1SS92'.
Connecting to jp.co.yumemi.android.codecheck.debug
Connected to the target VM, address: 'localhost:54462', transport: 'socket'
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/codecheck.debu: Late-enabling -Xcheck:jni
E/codecheck.debu: Unknown bits set in runtime_flags: 0x8000
W/ActivityThread: Application jp.co.yumemi.android.codecheck.debug is waiting for the debugger on port 8100...
I/System.out: Sending WAIT chunk
I/System.out: Debugger has connected
I/System.out: waiting for debugger to settle...
I/chatty: uid=10253(jp.co.yumemi.android.codecheck.debug) identical 1 line
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1485)
W/codecheck.debu: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
    Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
I/AdrenoGLES: QUALCOMM build                   : ba734b1, I0a3e8c4129
    Build Date                       : 11/08/19
    OpenGL ES Shader Compiler Version: EV031.27.05.02
    Local Branch                     : 
    Remote Branch                    : refs/tags/AU_LINUX_ANDROID_LA.UM.7.8.9.C1.08.00.00.516.287
    Remote Branch                    : NONE
    Reconstruct Branch               : NOTHING
    Build Config                     : S P 8.0.11 AArch64
I/AdrenoGLES: PFP: 0x016ee183, ME: 0x00000000
W/Gralloc3: mapper 3.x is not supported
W/RenderThread: type=1400 audit(0.0:575): avc: denied { read } for name="u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=25972 scontext=u:r:untrusted_app:s0:c253,c256,c512,c768 tcontext=u:object_r:vendor_default_prop:s0 tclass=file permissive=0
E/libc: Access denied finding property "vendor.gralloc.disable_ahardware_buffer"
Kotaro666-dev commented 1 year ago

エラー調査

以下のエラーは Pixel 3 の Android バージョン 10 でビルド時に発生する模様。

W/Gralloc3: mapper 3.x is not supported
E/libc: Access denied finding property "vendor.gralloc.disable_ahardware_buffer"

参考資料

https://github.com/flutter/flutter/issues/50405

Kotaro666-dev commented 1 year ago

デバッグログ調査

検証アプリ情報

ログ

W/codecheck.debu: Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (unsupported,core-platform-api, reflection, allowed)
    Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (unsupported,core-platform-api, reflection, allowed)
    Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (unsupported,core-platform-api, reflection, allowed)
D/HostConnection: createUnique: call
D/HostConnection: HostConnection::get() New Host Connection established 0xb40000703d926b50, tid 6697
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_0 
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
    Failed to initialize 101010-2 format, error = EGL_SUCCESS
Kotaro666-dev commented 1 year ago

デバッグログ調査結果

以下のコメントでまとめたログ調査を行う限り、レイアウトエラーやアプリのクラッシュが発生する箇所が見当たりませんでした。

Kotaro666-dev commented 1 year ago

例外エラーのキャッチ

検索文字を空文字で検索しようとした際に、発生する。

E/[Exception]tryRequestGithubRepositories: io.ktor.client.features.ClientRequestException: Client request(https://api.github.com/search/repositories?q=) invalid: 422 Unprocessable Entity. Text: "{"message":"Validation Failed","errors":[{"resource":"Search","field":"q","code":"missing"}],"documentation_url":"https://docs.github.com/v3/search"}"

現在は例外をキャッチできるため、アプリクラッシュしない。 ただし、空文字だったらリクエストできない仕組みにしておきたい。

Kotaro666-dev commented 1 year ago

HTTPリクエスト時の問題

コルーチンの runBlocking で UI メインスレッドをブロックしてしまう実装となっている。

fun searchGithubRepositories(searchKeyword: String): List<GithubRepository> = runBlocking {
        return@runBlocking withContext(Dispatchers.IO) {
            try {
                val response = tryRequestGithubRepositories(searchKeyword)
                val jsonItems = tryParseResponseBody(response) ?: return@withContext listOf()
                val githubRepositories = createGithubRepositoryList(jsonItems)
                Log.d("検索した日時", Date().toString())
                return@withContext githubRepositories
            } catch (e: Exception) {
                return@withContext listOf()
            }
        }
    }
Kotaro666-dev commented 1 year ago

対応内容が develop にマージされたため、本 ISSUE をクローズします。

Kotaro666-dev commented 1 year ago

以下の不具合が見つかったため、再度 issue をオープンにします。

不具合

検索結果詳細画面から検索画面に戻ると、検索結果一覧が初期化されてしまっている

Kotaro666-dev commented 1 year ago

不具合対応が完了したため、本 issue を再度クローズします。