The two-year gap (sede vacante) between the death of Clement V in 1314 and the election of John XXII in 1316 was due to extreme disagreement between the cardinals who were split into two factions. After two years, Philip V of France finally managed to arrange a conclave of twenty-three cardinals in Lyons. They duly elected John XXII Pope and he was crowned in Lyon. He set up his residence in Avignon rather than Rome, the beginning of the Avignon Papacy.
John involved himself in the politics and religious movements of many European countries in order to advance the interests of the Church. This made him a very controversial pope at the time.
Before John's election a contest had begun for the imperial crown between Louis IV of Bavaria and his opponent, Frederick I of Austria. John was neutral at first; but in 1323, when Louis had won and became Holy Roman Emperor, the Guelph (papal) party and the Ghibelline (imperial) party began a serious quarrel. This was partly provoked by John's extreme claims of authority over the empire and also partly by Louis's support of the spiritual Franciscans, whom John XXII condemned for their insistence on evangelical poverty. Louis was assisted by Marsilius of Padua, and later by the British monk William of Ockham. Louis invaded Italy, entered Rome and set up Pietro Rainalducci as antipope Nicholas V in 1328. The project was a fiasco, and Guelphic predominance at Rome was later restored. However, Louis had silenced the papal claims, and John stayed the rest of his life in Avignon.
Pope John XXII was involved in a theological controversy involving the Beatific Vision. Beginning before he was Pope, he argued that those who died in the faith did not see the presence of God until the Last Judgment. The point is important to Catholics, since if the dead are not in the presence of God, then the whole idea of prayers to the saints would seem to be undermined. John continued this argument for a time in sermons while he was pope, although he never expressed his argument as an ex cathedra teaching. He eventually backed down from his position, and agreed that those who died while in the faith do indeed enjoy the Beatific Vision.
Pope John XXII was not considered to have become a heretic despite his denial for many years of the Catholic doctrine that souls of persons who die in grace are immediately admitted to the Beatific Vision since this doctrine was not formally established by the Church, a lacuna that his successor Pope Benedict XII immediately filled by his legislation in the encyclical Benedictus Deus which formally made this doctrine a part of Church teaching.
Pope John XXII was also an excellent administrator and did much efficient reorganizing.