In order to understand the different effects of Ca and Mg doping on the electronic transport properties of LiCoO2,which is the primary cathode material in Li-ion secondary batteries,the electronic structures of the relevant systems are studied with the ab initio method based on the density-functional theory. It is found that both Ca and Mg partial substitution for Co in LiCoO2 crystal will give rise to partially occupied acceptor band near the Fermi level,but these bands are substantially localized. Moreover,Ca-doped system has a clear energy gap between the acceptor band and the valence band,whereas for the Mg-doped system there isn't such a gap. It's believed that the existence of this gap is the main factor resulting in the non-significant increase of the electronic conductivity in the Ca-doped LiCoO2. In addition,the remarkable distinction in the ionic radii of Ca2+ and Mg2+ can also induce noticeably different effects on the electronic conductivities.