A method for processing a collision between a random access procedure and a measurement gap, comprising: configuring, by a base station, a measurement gap to a terminal for conducting an inter-frequency or an inter-RAT measurement; performing, by the terminal, a random access procedure for accessing a network or synchronizing with the network and acquiring resource allocation, wherein the random access procedure is a contention-based random access procedure and comprises the steps of: transmitting, by the terminal, a random access preamble through an uplink random access channel, RACH, to the base station; monitoring, by the terminal, the Physical Downlink Control Channel, PDCCH, for a random access response message transmitted from the base station during a random access response window; transmitting, by the terminal, a scheduled transmission message on an Uplink-Shared Channel, UL-SCH, and activating a contention resolution timer after transmitting the scheduled transmission message; monitoring, by the terminal, the Physical Downlink Control Channel, PDCCH, for a contention resolution message transmitted from the base station; and canceling, by the terminal, the measurement gap if the random access response window or the operating time of the contention resolution timer has an overlap with the measurement gap. configuring, by a base station, a measurement gap to a terminal for conducting an inter-frequency or an inter-RAT measurement; performing, by the terminal, a random access procedure for accessing a network or synchronizing with the network and acquiring resource allocation, wherein the random access procedure is a contention-based random access procedure and comprises the steps of: transmitting, by the terminal, a random access preamble through an uplink random access channel, RACH, to the base station; monitoring, by the terminal, the Physical Downlink Control Channel, PDCCH, for a random access response message transmitted from the base station during a random access response window; transmitting, by the terminal, a scheduled transmission message on an Uplink-Shared Channel, UL-SCH, and activating a contention resolution timer after transmitting the scheduled transmission message; monitoring, by the terminal, the Physical Downlink Control Channel, PDCCH, for a contention resolution message transmitted from the base station; and canceling, by the terminal, the measurement gap if the random access response window or the operating time of the contention resolution timer has an overlap with the measurement gap. transmitting, by the terminal, a random access preamble through an uplink random access channel, RACH, to the base station; monitoring, by the terminal, the Physical Downlink Control Channel, PDCCH, for a random access response message transmitted from the base station during a random access response window; transmitting, by the terminal, a scheduled transmission message on an Uplink-Shared Channel, UL-SCH, and activating a contention resolution timer after transmitting the scheduled transmission message; monitoring, by the terminal, the Physical Downlink Control Channel, PDCCH, for a contention resolution message transmitted from the base station; and canceling, by the terminal, the measurement gap if the random access response window or the operating time of the contention resolution timer has an overlap with the measurement gap.