4. If the roots of the equation $a^{x}+2 x-4=0(a>0, a \neq 1)$ are $u_{1}, u_{2}, \cdots, u_{k}\left(k \in \mathbf{N}_{+}\right)$, and the roots of the equation
$$
\log _{a} 2 x+x-2=0(a>0, a \neq 1)
$$

are $v_{1}, v_{2}, \cdots, v_{l}\left(l \in \mathbf{N}_{+}\right)$. Then
$$
\frac{u_{1}+u_{2}+\cdots+u_{k}+v_{1}+v_{2}+\cdots+v_{l}}{k+l}
$$

is ( ).
(A) $\frac{1}{4}$
(B) $\frac{1}{2}$
(C) 1
(D) 2
4.C.

The equation $a^{x}+2 x-4=0 \Leftrightarrow \frac{a^{x}}{2}=2-x$, its roots are the x-coordinates of the intersection points of $y=\frac{a^{x}}{2}$ and $y=2-x$.

The equation $\log _{a} 2 x+x-2=0 \Leftrightarrow \log _{a} 2 x=2-x$, its roots are the x-coordinates of the intersection points of $y=\log _{a} 2 x$ and $y=2-x$.

Since $y=\frac{a^{x}}{2}$ and $y=\log _{a} 2 x$ are inverse functions, their graphs are symmetric about the line $y=x$. Therefore, the arithmetic mean of all roots is the x-coordinate of the intersection point of $y=x$ and $y=2-x$, which is 1.