How did Africans resist colonial rule?
The first thing one should note is that Africa is a huge continent with many different countries, languages, cultures and traditions. European colonization of Africa actually started in antiquity, with Phoenician colonies in what is now Tunisia (Queen Dido in Virgil is actually the descendant of Phoenicians) and Greek colonies in Egypt (Cleopatra was actually of Greek descent, part of a Ptolemaic dynasty that ruled Egypt until it was conquered by the Romans). Starting in the Renaissance, different parts of Africa were colonized by Britain, France, Germany, Italy, Spain, Belgium, Holland, and Portugal. Both the types of colonialism and manners of resistance were tremendously varied.
Several countries obtained independence by direct, violent rebellion. An example of this would be the Algerian War of Independence against France. The Republic of Liberia was founded as an independent republic, and was recognized as an independent nation shortly after the US Civil War; it did not actually rebel against a colonial power. Nigerian independence was gradual, with both Nigerian nationalists and British colonial administrators converging in a transition to self-government and then formal independence.
Overall, resistance ranged from violent to non-violent and from armed conflict to cultural protest by revival and preservation of local traditions.
Africa is a complex and diverse continent, with hundreds of languages and dialects, almost every ecosystem on Earth, and the world's largest desert separating major populations. So there is no easy way to summarize how Africans resisted the colonial powers that carved her up for the better part of four centuries. If I had to categorize them, I would say African resisted colonial rule in some cases violently, in some cases non-violently, and in still other instances used passive resistance.
Violent Resistance - There are numerous examples of this, but the Algerian revolt against France in the 1960s, the revolts of the Zulu in South Africa (see Battle of Islandlwana) and Mau Mau in kenya against British rule, among many others.
Non-violent Resistance - In the Year of African Independence, 1961, 17 countries declared themselves independent of colonial powers, most of them non-violently, through protest and/or negotiation.
Passive Resistance - This method was very common over the centuries that European powers ran most of Africa, and involved working more slowly, sabatoging services such as rail lines, or keeping tribal languages alive in villages and schools.