By the 15th century, Sub-Saharan Africa wasn't less sparsely populated than the Americas. The reason why the Americans could be colonized first is mostly a matter of disease. Smallpox devastated American natives whereas in Africa, malaria was devastating settlers. That's the major reason why Portuguese colonization of Africa was first only limited to remote outposts, many of them being located on islands (Cape Verde, Gorée, São Tomé, Principe, Zanzibar, Socotra). Portuguese colonists had much less difficulties to penetrate Brazil inland. Now it's also true Africans mastered iron smelting which wasn't the case of American natives, but no matter what it's certainly not because of a lack of interest that Africa wasn't colonized in-depth before the 19th century.
Also we cannot compare the relatively limited technological advantage of Europe at the 15th century to what it has become at the 19th century, after 4 centuries of control of global trade and the industrial revolution. What really gave an edge to Europeans was primarily the mastery of high seas navigation.
Technologically, european kingdoms could
conquer and hold territory in Africa's interior in the 18th century. I mentioned the devastation done by diseases because there are records of this occupation of the interior being done, and the costs of it. The solution was obvious though, in an era before modern nationalism and racism: just africanize the effort
. Empires then had no trouble with recruiting soldiers and even commanders in their colonies. Intra-empire mobility afterwards was an issue, but only became politicaly relevant towards the 19th century: dissatisfaction with limited prospects of advancemente leading to rebellion and independence in the americas.
The case I know of best is the portuguese effort to hold territory in the interior of Angola, as the state of Congo was collapsing. African mercenaries played a role, african nobles were recruited, and even though most european soldiers sent there died of disease, some survived. Enough, so long as mor e people kept being send. It wasn't that
worse than Brazil. The war to expel the dutch from Brasil was fought by a mixed army of portuguese settlers, native americans and descendants of africans. Its native commander was ennobled and his native ancestry was not a problem. The barrier, which also applied to descendants of european colonists, was that the office holders in a colony would not easily be allowed to take office in Europe or in a different colony. That was a form of elite monopoly
on offices, which european aristocratic families held, being closer to court.
What Angola lacked, and the decisive reasons why it was Brasil and not Angola that got colonized in the 18th century, were good navigable rivers, and wealth as a draw. Africa was almost entirely "empty" of permanent settlements, same as Brasil was, so no war loot in either place. But Brasil had huge mineral wealth available for picking: gold and diamonds, the wealthiest fields in the world in the 18th century. Angola didn't. Diamonds would be found only much, much later and far in the interior. Namibia's diamonds, sitting on the desert beaches
, ironically remained unnoticed and undisturbed also until quite late, even while european ships passed them by en route to fill holds with lesser riches in Asia.
Without wealth as a draw, Africa just couldn't compete with Brasil in terms of appeal for colonists. Colonists chose to go to Brasil. That imo was more decisive that the ravages of disease in Africa.
This is not to dismiss that problem of disease. In terms of effort by the portuguese crown, at one point the investment in Angola was quite high. The first iron foundry set up in a colony was in Angola, Nova Oeiras
. It may not seem far from the coast, nothing comparable to Minas Gerais in Brasil, but but was 200 km. That was not a "coastal outpost", as people think of european presence in Africa before the 19th century. It was the interior, with all its difficulties. There was an effort not just to built military posts, also to fixate local populations into settlements and to develop a local economy capable of exporting new local products made with imported technology. Basques were hired to build the foundry and teach local blacksmiths methods for larger-scale production.
But the effort foundered. The african blacksmiths had an elite status as indispensable artisans in their communities. They would not willingly convert to wage laborers in a factory. Just as industrialization destroyed artisanal work in Europe only through violence, expropriation and threat of starvation, so would it have to use violence there to convert artisans into factory workers. But the government apparatus, the troops, budget and colonists available never could support that: Africa is vast, locals simply left and no one could keep them there. And the foreign skilled workers died of disease
before teaching the locals. The project endured from 1766 to 1772, then the factory was shut down and restarted in Brasil. There it prospered. People wanted to go to Brasil, not Angola. The europeans who tried to set up trade with local blacksmiths tended to get sick and die in a dozen years or less. With replacements and time nature could have been tamed. But there were no replacements - only convicts went to Angola, free colonists always chose wealthier Brasil.