For this theorem, it is crucial that the group $G$ is finite, and this cannot be relaxed. Think for instance in $\mathbb{S}^1=\mathbb{R}/\mathbb{Z}$ or $\mathbb{T}^2=\mathbb{R}^2/\mathbb{Z}\times\mathbb{Z}$: the cohomology of order 1 or 2 of $\mathbb{R}$ or $\mathbb{R}^2$ is trivial, but not that of $\mathbb{S}^1$ or $\mathbb{T}^2$