在 android 25 的版本以下 CodeLocatorLayoutInflator 调用 createView 会报 nullpoint

Open
#25 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
android, java
Domain
mobile

Research direction

Start at CodeLocatorLayoutInflator.createView and trace how HookInflater obtains the Context from LayoutInflater on Android versions below 25. Reproduce the NullPointerException with the reported workaround disabled, then verify that view creation and skinning work without disabling HookInflater on those versions.

Written by the indexing model from the issue text.

Description

具体原因是 Android 25 版本以下 LayoutInflater 实现不同 ,args[0] 为 context 的初始化方式不同,最后导致new view的时候报 NullPointerExeception,我找不到修复的办法,目前是简单关闭了HookInflater 功能来绕过的
绕过代码如下

        if(Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1) {
            CLog.i(TAG, "CodeLocator 关闭对这个 ${Build.VERSION.SDK_INT} 版本的支持,会导致不能换肤")
            CodeLocator.config(CodeLocatorConfig.Builder().enableHookInflater(false).build())
        }
Dominant language
Java
Stars
2.2k
Forks
182
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bytedance/CodeLocator

All issues in bytedance/CodeLocator

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.